From 0bf99d9d16d33037827f48836d982688974f25f2 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Wed, 10 Sep 2025 14:16:10 +0200 Subject: [PATCH] NR UE: introduce the hyper frame number (HFN) in PHY, MAC and RRC layer Provide it to the function configure_ntn_ta() so it can be used when a new ntn_Config_r17 is received. --- executables/nr-ue.c | 6 +++++- openair1/PHY/defs_nr_UE.h | 5 ++++- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 1 + .../SCHED_NR_UE/phy_procedures_nr_ue_sl.c | 2 ++ openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- .../SIMULATION/NR_PHY/nr_unitary_common.c | 1 + openair2/COMMON/mac_messages_types.h | 2 ++ openair2/COMMON/rrc_messages_types.h | 5 +++++ openair2/LAYER2/NR_MAC_UE/config_ue.c | 20 ++++++++++++------- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 5 ++++- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 5 +++-- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 14 +++++++++---- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h | 6 ++++++ openair2/RRC/NR_UE/L2_interface_ue.c | 20 +++++++++++++++---- openair2/RRC/NR_UE/L2_interface_ue.h | 3 ++- openair2/RRC/NR_UE/rrc_UE.c | 15 +++++++++++--- openair2/RRC/NR_UE/rrc_defs.h | 1 + openair2/RRC/NR_UE/rrc_proto.h | 2 +- 18 files changed, 89 insertions(+), 26 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 5721b45f8d..ab9696b41a 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -434,8 +434,10 @@ void processSlotTX(void *arg) nr_sidelink_indication_t sl_indication = {.module_id = UE->Mod_id, .gNB_index = proc->gNB_id, .cc_id = UE->CC_id, + .hfn_tx = proc->hfn_tx, .frame_tx = proc->frame_tx, .slot_tx = proc->nr_slot_tx, + .hfn_rx = proc->hfn_rx, .frame_rx = proc->frame_rx, .slot_rx = proc->nr_slot_rx, .slot_type = SIDELINK_SLOT_TYPE_TX, @@ -968,6 +970,8 @@ void *UE_thread(void *arg) curMsg.proc.nr_slot_tx = (absolute_slot + duration_rx_to_tx) % nb_slot_frame; curMsg.proc.frame_rx = (absolute_slot / nb_slot_frame) % MAX_FRAME_NUMBER; curMsg.proc.frame_tx = ((absolute_slot + duration_rx_to_tx) / nb_slot_frame) % MAX_FRAME_NUMBER; + curMsg.proc.hfn_rx = (absolute_slot / nb_slot_frame) / MAX_FRAME_NUMBER; + curMsg.proc.hfn_tx = ((absolute_slot + duration_rx_to_tx) / nb_slot_frame) / MAX_FRAME_NUMBER; if (UE->received_config_request) { if (UE->sl_mode) { curMsg.proc.rx_slot_type = sl_nr_ue_slot_select(sl_cfg, curMsg.proc.nr_slot_rx, TDD); @@ -1048,7 +1052,7 @@ void *UE_thread(void *arg) } if (curMsg.proc.nr_slot_rx == 0) - nr_ue_rrc_timer_trigger(UE->Mod_id, curMsg.proc.frame_rx, curMsg.proc.gNB_id); + nr_ue_rrc_timer_trigger(UE->Mod_id, curMsg.proc.hfn_rx, curMsg.proc.frame_rx, curMsg.proc.gNB_id); // RX slot processing. We launch and forget. notifiedFIFO_elt_t *newRx = newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), curMsg.proc.nr_slot_tx, NULL, UE_dl_processing); diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 935226b238..343fb5cdd7 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -538,11 +538,14 @@ typedef struct { /// NR slot index within frame_rx [0 .. slots_per_frame - 1] to act upon for transmission int nr_slot_rx; int tx_slot_type; - //#endif /// frame to act upon for transmission int frame_tx; /// frame to act upon for reception int frame_rx; + /// hyper frame number to act upon for transmission + int hfn_tx; + /// hyper frame number to act upon for reception + int hfn_rx; } UE_nr_rxtx_proc_t; typedef struct { diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 51c7bf2c55..1760f54e50 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -95,6 +95,7 @@ void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind, dl_ind->gNB_index = proc->gNB_id; dl_ind->module_id = ue->Mod_id; dl_ind->cc_id = ue->CC_id; + dl_ind->hfn = proc->hfn_rx; dl_ind->frame = proc->frame_rx; dl_ind->slot = proc->nr_slot_rx; dl_ind->phy_data = phy_data; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c index e03c0a1fae..d1bbb7ae99 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c @@ -44,8 +44,10 @@ void nr_fill_sl_indication(nr_sidelink_indication_t *sl_ind, sl_ind->gNB_index = proc->gNB_id; sl_ind->module_id = ue->Mod_id; sl_ind->cc_id = ue->CC_id; + sl_ind->hfn_rx = proc->hfn_rx; sl_ind->frame_rx = proc->frame_rx; sl_ind->slot_rx = proc->nr_slot_rx; + sl_ind->hfn_tx = proc->hfn_tx; sl_ind->frame_tx = proc->frame_tx; sl_ind->slot_tx = proc->nr_slot_tx; sl_ind->phy_data = phy_data; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 82984657d3..1a4ae0c254 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -956,7 +956,7 @@ int main(int argc, char **argv) //Configure UE NR_BCCH_BCH_Message_t *mib = get_new_MIB_NR(scc); nr_rrc_mac_config_req_mib(0, 0, mib->message.choice.mib, false, false); - nr_rrc_mac_config_req_cg(0, 0, UE_CellGroup, UE_Capability_nr); + nr_rrc_mac_config_req_cg(0, 0, 0, 0, UE_CellGroup, UE_Capability_nr); asn1cFreeStruc(asn_DEF_NR_CellGroupConfig, UE_CellGroup); diff --git a/openair1/SIMULATION/NR_PHY/nr_unitary_common.c b/openair1/SIMULATION/NR_PHY/nr_unitary_common.c index 604e7a8c2a..ba9712391c 100644 --- a/openair1/SIMULATION/NR_PHY/nr_unitary_common.c +++ b/openair1/SIMULATION/NR_PHY/nr_unitary_common.c @@ -163,6 +163,7 @@ typedef uint32_t channel_t; int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, + const int hfn, const frame_t frame, const int slot, const rnti_t rnti, diff --git a/openair2/COMMON/mac_messages_types.h b/openair2/COMMON/mac_messages_types.h index c5c18a12f2..d0d38c5938 100644 --- a/openair2/COMMON/mac_messages_types.h +++ b/openair2/COMMON/mac_messages_types.h @@ -121,6 +121,7 @@ typedef struct RrcMacBcchDataInd_s { } RrcMacBcchDataInd; typedef struct NRRrcMacBcchDataInd_s { + uint32_t hfn; uint32_t frame; uint8_t slot; uint32_t sdu_size; @@ -134,6 +135,7 @@ typedef struct NRRrcMacBcchDataInd_s { } NRRrcMacBcchDataInd; typedef struct NRRrcMacSBcchDataInd_s { + uint32_t hfn; uint32_t frame; uint8_t slot; uint32_t sdu_size; diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 255da9f189..ab8f93763e 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -438,6 +438,7 @@ typedef struct rrc_subframe_process_s { } RrcSubframeProcess; typedef struct nrrrc_frame_process_s { + int hfn; int frame; int gnb_id; } NRRrcFrameProcess; @@ -475,6 +476,8 @@ typedef struct { typedef struct { NR_CellGroupConfig_t *cellGroupConfig; NR_UE_NR_Capability_t *UE_NR_Capability; + int hfn; + int frame; } nr_mac_rrc_config_cg_t; typedef struct { NR_BCCH_BCH_Message_t *bcch; @@ -487,6 +490,8 @@ typedef struct { } nr_mac_rrc_config_sib1_t; typedef struct { NR_SIB19_r17_t *sib19; + int hfn; + int frame; bool can_start_ra; } nr_mac_rrc_config_other_sib_t; diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index f592423c5a..de488fe459 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -305,7 +305,9 @@ static void calculate_ue_sat_ta(const position_t *position_params, // populate ntn_ta structure from mac static void configure_ntn_ta(module_id_t module_id, ntn_timing_advance_componets_t *ntn_ta, - const NR_NTN_Config_r17_t *ntn_Config_r17) + const NR_NTN_Config_r17_t *ntn_Config_r17, + int hfn, + int frame) { if (!ntn_Config_r17) return; @@ -380,7 +382,7 @@ static void configure_ntn_ta(module_id_t module_id, ntn_ta->N_UE_TA_drift_variant); } -static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t *scc, int cc_idP) +static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t *scc, int cc_idP, int hfn, int frame) { fapi_nr_config_request_t *cfg = &mac->phy_config.config_req; @@ -555,7 +557,7 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t // NTN Config if (scc->ext2) { UPDATE_IE(mac->sc_info.ntn_Config_r17, scc->ext2->ntn_Config_r17, NR_NTN_Config_r17_t); - configure_ntn_ta(mac->ue_id, &mac->ntn_ta, mac->sc_info.ntn_Config_r17); + configure_ntn_ta(mac->ue_id, &mac->ntn_ta, mac->sc_info.ntn_Config_r17, hfn, frame); } else { asn1cFreeStruc(asn_DEF_NR_NTN_Config_r17, mac->sc_info.ntn_Config_r17); } @@ -1947,7 +1949,7 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *si AssertFatal(!ret, "mutex failed %d\n", ret); } -void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19, bool can_start_ra) +void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19, int hfn, int frame, bool can_start_ra) { NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); int ret = pthread_mutex_lock(&mac->if_mutex); @@ -1956,7 +1958,7 @@ void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19, b if (sib19) { // update ntn_Config_r17 with received values UPDATE_IE(mac->sc_info.ntn_Config_r17, sib19->ntn_Config_r17, NR_NTN_Config_r17_t); - configure_ntn_ta(mac->ue_id, &mac->ntn_ta, mac->sc_info.ntn_Config_r17); + configure_ntn_ta(mac->ue_id, &mac->ntn_ta, mac->sc_info.ntn_Config_r17, hfn, frame); } if (mac->state == UE_RECEIVING_SIB && can_start_ra) mac->state = UE_PERFORMING_RA; @@ -1966,6 +1968,8 @@ void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19, b static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac, int cc_idP, + int hfn, + int frame, const NR_ReconfigurationWithSync_t *reconfWithSync) { reset_mac_inst(mac); @@ -1985,7 +1989,7 @@ static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac, mac->physCellId = *scc->physCellId; mac->dmrs_TypeA_Position = scc->dmrs_TypeA_Position; UPDATE_IE(mac->tdd_UL_DL_ConfigurationCommon, scc->tdd_UL_DL_ConfigurationCommon, NR_TDD_UL_DL_ConfigCommon_t); - config_common_ue(mac, scc, cc_idP); + config_common_ue(mac, scc, cc_idP, hfn, frame); // Build the list of all the valid/transmitted SSBs according to the config LOG_D(NR_MAC,"Build SSB list\n"); build_ssb_list(mac); @@ -2754,6 +2758,8 @@ static void handle_mac_uecap_info(NR_UE_MAC_INST_t *mac, NR_UE_NR_Capability_t * void nr_rrc_mac_config_req_cg(module_id_t module_id, int cc_idP, + int hfn, + int frame, NR_CellGroupConfig_t *cell_group_config, NR_UE_NR_Capability_t *ue_Capability) { @@ -2772,7 +2778,7 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id, mac->servCellIndex = spCellConfig->servCellIndex ? *spCellConfig->servCellIndex : 0; if (spCellConfig->reconfigurationWithSync) { LOG_A(NR_MAC, "Received reconfigurationWithSync\n"); - handle_reconfiguration_with_sync(mac, cc_idP, spCellConfig->reconfigurationWithSync); + handle_reconfiguration_with_sync(mac, cc_idP, hfn, frame, spCellConfig->reconfigurationWithSync); } if (scd) { mac->tag_Id = scd->tag_Id; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 4897a8fab8..52cb38e4de 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -73,6 +73,7 @@ void nr_ue_decode_BCCH_DL_SCH(NR_UE_MAC_INST_t *mac, uint8_t ack_nack, uint8_t *pduP, uint32_t pdu_len, + int hfn, int frame, int slot); @@ -82,6 +83,8 @@ void nr_release_mac_config_logicalChannelBearer(NR_UE_MAC_INST_t *mac, long chan void nr_rrc_mac_config_req_cg(module_id_t module_id, int cc_idP, + int hfn, + int frame, NR_CellGroupConfig_t *cell_group_config, NR_UE_NR_Capability_t *ue_Capability); @@ -90,7 +93,7 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mibP void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *sib1, bool can_start_ra); struct position; /* forward declaration */ -void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19_r17, bool can_start_ra); +void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19_r17, int hfn, int frame, bool can_start_ra); void nr_rrc_mac_resume_rb(module_id_t module_id, bool is_srb, int rb_id); void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t cause); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index aeb15fe864..86d7b9254f 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -361,12 +361,13 @@ void nr_ue_decode_BCCH_DL_SCH(NR_UE_MAC_INST_t *mac, uint8_t ack_nack, uint8_t *pduP, uint32_t pdu_len, + int hfn, int frame, int slot) { if(ack_nack) { LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n"); - nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, frame, slot, 0, mac->physCellId, 0, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len); + nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, hfn, frame, slot, 0, mac->physCellId, 0, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len); if (mac->get_sib1) mac->get_sib1 = false; for (int i = 0; i < MAX_SI_GROUPS; i++) { @@ -383,7 +384,7 @@ void nr_ue_decode_BCCH_DL_SCH(NR_UE_MAC_INST_t *mac, } else { LOG_E(NR_MAC, "Got NACK on NR-BCCH-DL-SCH-Message (%s)\n", mac->get_sib1 ? "SIB1" : "other SI"); - nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, frame, slot, 0, mac->physCellId, 0, NR_BCCH_DL_SCH, NULL, 0); + nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, hfn, frame, slot, 0, mac->physCellId, 0, NR_BCCH_DL_SCH, NULL, 0); } } diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 0939b52c7a..09f3218f1e 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -123,7 +123,7 @@ static int handle_bcch_bch(NR_UE_MAC_INST_t *mac, else mac->frequency_range = FR1; // fixed 3 bytes MIB PDU - nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, 0, 0, 0, cell_id, ssb_arfcn, NR_BCCH_BCH, (uint8_t *) pduP, 3); + nr_mac_rrc_data_ind_ue(mac->ue_id, cc_id, gNB_index, 0, 0, 0, 0, cell_id, ssb_arfcn, NR_BCCH_BCH, (uint8_t *) pduP, 3); return 0; } @@ -134,10 +134,11 @@ static int handle_bcch_dlsch(NR_UE_MAC_INST_t *mac, uint8_t ack_nack, uint8_t *pduP, uint32_t pdu_len, + int hfn, int frame, int slot) { - nr_ue_decode_BCCH_DL_SCH(mac, cc_id, gNB_index, ack_nack, pduP, pdu_len, frame, slot); + nr_ue_decode_BCCH_DL_SCH(mac, cc_id, gNB_index, ack_nack, pduP, pdu_len, hfn, frame, slot); return 0; } @@ -301,6 +302,7 @@ static uint32_t nr_ue_dl_processing(NR_UE_MAC_INST_t *mac, nr_downlink_indicatio rx_indication_body.pdsch_pdu.ack_nack, rx_indication_body.pdsch_pdu.pdu, rx_indication_body.pdsch_pdu.pdu_length, + dl_info->hfn, dl_info->frame, dl_info->slot)) << FAPI_NR_RX_PDU_TYPE_SIB; break; @@ -389,6 +391,7 @@ static void handle_sl_bch(int ue_id, sl_nr_ue_mac_params_t *sl_mac, uint8_t *const sl_mib, const uint8_t len, + int hfn_rx, uint16_t frame_rx, uint16_t slot_rx, uint16_t rx_slss_id) @@ -421,7 +424,7 @@ static void handle_sl_bch(int ue_id, sl_mac->decoded_DFN = frame; sl_mac->decoded_slot = slot; - nr_mac_rrc_data_ind_ue(ue_id, 0, 0, frame_rx, slot_rx, 0, rx_slss_id, 0, NR_SBCCH_SL_BCH, (uint8_t *)sl_mib, len); + nr_mac_rrc_data_ind_ue(ue_id, 0, 0, hfn_rx, frame_rx, slot_rx, 0, rx_slss_id, 0, NR_SBCCH_SL_BCH, (uint8_t *)sl_mib, len); return; } @@ -433,6 +436,7 @@ if PSBCH rx - handle_psbch() if PSSCH DATa rx - handle slsch() */ void sl_nr_process_rx_ind(int ue_id, + int hfn, uint32_t frame, uint32_t slot, sl_nr_ue_mac_params_t *sl_mac, @@ -456,6 +460,7 @@ void sl_nr_process_rx_ind(int ue_id, sl_mac, rx_ind->rx_indication_body[num_pdus - 1].ssb_pdu.psbch_payload, 4, + hfn, frame, slot, rx_ind->rx_indication_body[num_pdus - 1].ssb_pdu.rx_slss_id); @@ -488,11 +493,12 @@ void nr_ue_sl_indication(nr_sidelink_indication_t *sl_indication) uint16_t slot = sl_indication->slot_rx; uint16_t frame = sl_indication->frame_rx; + int hfn = sl_indication->hfn_rx; sl_nr_ue_mac_params_t *sl_mac = mac->SL_MAC_PARAMS; if (sl_indication->rx_ind) { - sl_nr_process_rx_ind(ue_id, frame, slot, sl_mac, sl_indication->rx_ind); + sl_nr_process_rx_ind(ue_id, hfn, frame, slot, sl_mac, sl_indication->rx_ind); } else { nr_ue_sidelink_scheduler(sl_indication, mac); } diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h index a1175282f0..66afa266f8 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h @@ -56,6 +56,8 @@ typedef struct { uint32_t gNB_index; /// component carrier id int cc_id; + /// hyper frame number + int hfn; /// frame frame_t frame; /// slot @@ -101,10 +103,14 @@ typedef struct { uint32_t gNB_index; /// component carrier id int cc_id; + /// hyper frame number rx + int hfn_rx; /// frame rx frame_t frame_rx; /// slot rx uint32_t slot_rx; + /// hyper frame number tx + int hfn_tx; /// frame tx frame_t frame_tx; /// slot tx diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index bae8915916..12ed0953dd 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -59,6 +59,7 @@ void nr_mac_rrc_sync_ind(const module_id_t module_id, const frame_t frame, const void nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, + const int hfn, const frame_t frame, const int slot, const rnti_t rnti, @@ -97,6 +98,7 @@ void nr_mac_rrc_data_ind_ue(const module_id_t module_id, else { NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = 0; } + NR_RRC_MAC_BCCH_DATA_IND (message_p).hfn = hfn; NR_RRC_MAC_BCCH_DATA_IND (message_p).frame = frame; //frameP NR_RRC_MAC_BCCH_DATA_IND (message_p).slot = slot; NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index; @@ -120,6 +122,7 @@ void nr_mac_rrc_data_ind_ue(const module_id_t module_id, message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_SBCCH_DATA_IND); memset(NR_RRC_MAC_SBCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE); memcpy(NR_RRC_MAC_SBCCH_DATA_IND (message_p).sdu, pduP, sdu_size); + NR_RRC_MAC_SBCCH_DATA_IND (message_p).hfn = hfn; NR_RRC_MAC_SBCCH_DATA_IND (message_p).frame = frame; //frameP NR_RRC_MAC_SBCCH_DATA_IND (message_p).slot = slot; NR_RRC_MAC_SBCCH_DATA_IND (message_p).sdu_size = sdu_size; @@ -139,7 +142,12 @@ void process_msg_rcc_to_mac(nr_mac_rrc_message_t *msg, int instance_id) nr_rrc_mac_config_req_reset(instance_id, msg->payload.config_reset.cause); break; case NR_MAC_RRC_CONFIG_CG: - nr_rrc_mac_config_req_cg(instance_id, 0, msg->payload.config_cg.cellGroupConfig, msg->payload.config_cg.UE_NR_Capability); + nr_rrc_mac_config_req_cg(instance_id, + 0, + msg->payload.config_cg.hfn, + msg->payload.config_cg.frame, + msg->payload.config_cg.cellGroupConfig, + msg->payload.config_cg.UE_NR_Capability); ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, msg->payload.config_cg.cellGroupConfig); break; case NR_MAC_RRC_CONFIG_MIB: @@ -157,8 +165,11 @@ void process_msg_rcc_to_mac(nr_mac_rrc_message_t *msg, int instance_id) SEQUENCE_free(&asn_DEF_NR_SIB1, msg->payload.config_sib1.sib1, ASFM_FREE_EVERYTHING); } break; case NR_MAC_RRC_CONFIG_OTHER_SIB: { - bool can_start_ra = msg->payload.config_other_sib.can_start_ra; - nr_rrc_mac_config_other_sib(instance_id, msg->payload.config_other_sib.sib19, can_start_ra); + nr_rrc_mac_config_other_sib(instance_id, + msg->payload.config_other_sib.sib19, + msg->payload.config_other_sib.hfn, + msg->payload.config_other_sib.frame, + msg->payload.config_other_sib.can_start_ra); } break; case NR_MAC_RRC_RESUME_RB: nr_rrc_mac_resume_rb(instance_id, msg->payload.resume_rb.is_srb, msg->payload.resume_rb.rb_id); @@ -183,10 +194,11 @@ void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti, bool prepare_ itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(mod_id), message_p); } -void nr_ue_rrc_timer_trigger(int instance, int frame, int gnb_id) +void nr_ue_rrc_timer_trigger(int instance, int hfn, int frame, int gnb_id) { MessageDef *message_p; message_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NRRRC_FRAME_PROCESS); + NRRRC_FRAME_PROCESS(message_p).hfn = hfn; NRRRC_FRAME_PROCESS(message_p).frame = frame; NRRRC_FRAME_PROCESS(message_p).gnb_id = gnb_id; LOG_D(NR_RRC, "RRC timer trigger: frame %d\n", frame); diff --git a/openair2/RRC/NR_UE/L2_interface_ue.h b/openair2/RRC/NR_UE/L2_interface_ue.h index 5c7a4c16af..9a5e5ee2a8 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.h +++ b/openair2/RRC/NR_UE/L2_interface_ue.h @@ -29,6 +29,7 @@ void nr_mac_rrc_sync_ind(const module_id_t module_id, const frame_t frame, const void nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, + const int hfn, const frame_t frame, const int slot, const rnti_t rnti, @@ -45,7 +46,7 @@ void nr_mac_rrc_meas_ind_ue(module_id_t module_id, int rsrp_dBm); void nr_mac_rrc_inactivity_timer_ind(const module_id_t mod_id); void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti, bool prepare_payload); -void nr_ue_rrc_timer_trigger(int instance, int frame, int gnb_id); +void nr_ue_rrc_timer_trigger(int instance, int hfn, int frame, int gnb_id); void nr_mac_rrc_ra_ind(const module_id_t mod_id, bool success); void process_msg_rcc_to_mac(nr_mac_rrc_message_t *msg, int instance_id); #endif diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 24088749a5..7453107627 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -284,7 +284,7 @@ static void nr_rrc_process_ntnconfig(NR_UE_RRC_INST_t *rrc, NR_UE_RRC_SI_INFO *S nr_timer_start(&SI_info->SInfo_r17.sib19_timer); } -static void nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si, NR_UE_RRC_INST_t *rrc, int frame) +static void nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si, NR_UE_RRC_INST_t *rrc, int hfn, int frame) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_IN); @@ -373,6 +373,8 @@ static void nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si, rrc_msg.payload_type = NR_MAC_RRC_CONFIG_OTHER_SIB; nr_mac_rrc_config_other_sib_t *sib19_msg = &rrc_msg.payload.config_other_sib; asn_copy(&asn_DEF_NR_SIB19_r17, (void **)&sib19_msg->sib19, sib19); + sib19_msg->hfn = hfn; + sib19_msg->frame = frame; sib19_msg->can_start_ra = rrc->is_NTN_UE; nr_rrc_send_msg_to_mac(rrc, &rrc_msg); } @@ -768,6 +770,8 @@ static void nr_rrc_ue_process_masterCellGroup(NR_UE_RRC_INST_t *rrc, nr_mac_rrc_config_cg_t *mac_msg = &rrc_msg.payload.config_cg; mac_msg->cellGroupConfig = cellGroupConfig; mac_msg->UE_NR_Capability = rrc->UECap.UE_NR_Capability; + mac_msg->hfn = rrc->current_hfn; + mac_msg->frame = rrc->current_frame; nr_rrc_send_msg_to_mac(rrc, &rrc_msg); } @@ -816,7 +820,7 @@ static void nr_rrc_process_reconfiguration_v1530(NR_UE_RRC_INST_t *rrc, NR_RRCRe SEQUENCE_free(&asn_DEF_NR_SystemInformation, si, 1); } else { LOG_I(NR_RRC, "[UE %ld] Decoding dedicatedSystemInformationDelivery\n", rrc->ue_id); - nr_decode_SI(SI_info, si, rrc, rrc->current_frame); + nr_decode_SI(SI_info, si, rrc, rrc->current_hfn, rrc->current_frame); } } if (rec_1530->otherConfig) { @@ -1174,6 +1178,8 @@ static void nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc, int gNB_ nr_mac_rrc_config_cg_t *config_cg = &rrc_msg.payload.config_cg; config_cg->cellGroupConfig = cellGroupConfig; config_cg->UE_NR_Capability = rrc->UECap.UE_NR_Capability; + config_cg->hfn = rrc->current_hfn; + config_cg->frame = rrc->current_frame; nr_rrc_send_msg_to_mac(rrc, &rrc_msg); } } @@ -1598,6 +1604,7 @@ static void nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(NR_UE_RRC_INST_t *rrc, const uint8_t Sdu_len, const uint8_t rsrq, const uint8_t rsrp, + int hfn, int frame, int slot) { @@ -1637,7 +1644,7 @@ static void nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(NR_UE_RRC_INST_t *rrc, case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation: LOG_I(NR_RRC, "[UE %ld] %d:%d Decoding SI\n", rrc->ue_id, frame, slot); NR_SystemInformation_t *si = bcch_message->message.choice.c1->choice.systemInformation; - nr_decode_SI(SI_info, si, rrc, frame); + nr_decode_SI(SI_info, si, rrc, hfn, frame); break; case NR_BCCH_DL_SCH_MessageType__c1_PR_NOTHING: default: @@ -2620,6 +2627,7 @@ void *rrc_nrue(void *notUsed) } break; case NRRRC_FRAME_PROCESS: + rrc->current_hfn = NRRRC_FRAME_PROCESS(msg_p).hfn; rrc->current_frame = NRRRC_FRAME_PROCESS(msg_p).frame; LOG_D(NR_RRC, "Received %s: frame %d\n", ITTI_MSG_NAME(msg_p), rrc->current_frame); // increase the timers every 10ms (every new frame) @@ -2671,6 +2679,7 @@ void *rrc_nrue(void *notUsed) bcch->sdu_size, bcch->rsrq, bcch->rsrp, + bcch->hfn, bcch->frame, bcch->slot); break; diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index ae8837bff2..a5bd47b9fc 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -262,6 +262,7 @@ typedef struct NR_UE_RRC_INST_s { // 5G-S-TMSI uint64_t fiveG_S_TMSI; // Frame timing received from MAC + int current_hfn; int current_frame; //Sidelink params diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 1ebb728884..28bdeb6e51 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -73,7 +73,7 @@ int get_from_lte_ue_fd(); void nr_rrc_SI_timers(NR_UE_RRC_SI_INFO *SInfo); void init_SI_timers(NR_UE_RRC_SI_INFO *SInfo); -void nr_ue_rrc_timer_trigger(int module_id, int frame, int gnb_id); +void nr_ue_rrc_timer_trigger(int module_id, int hfn, int frame, int gnb_id); void handle_t300_expiry(NR_UE_RRC_INST_t *rrc); void handle_t430_expiry(NR_UE_RRC_INST_t *rrc);