From 3f35d462e9877e37a50e946d7356bf5ce3b30e09 Mon Sep 17 00:00:00 2001 From: francescomani <email@francescomani.it> Date: Fri, 13 Dec 2024 13:44:16 +0100 Subject: [PATCH] separate DL and UL timers at UE --- executables/nr-ue.c | 5 ++++- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 3 ++- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 18 +++++++++++------- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 7 +++++-- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h | 2 +- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index cc72eed2630..7bb508cfba0 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -519,7 +519,7 @@ void processSlotTX(void *arg) bool sl_tx_action = false; if (UE->if_inst) - UE->if_inst->slot_indication(UE->Mod_id); + UE->if_inst->slot_indication(UE->Mod_id, true); if (proc->tx_slot_type == NR_UPLINK_SLOT || proc->tx_slot_type == NR_MIXED_SLOT) { if (UE->sl_mode == 2 && proc->tx_slot_type == NR_SIDELINK_SLOT) { @@ -650,6 +650,9 @@ static int UE_dl_preprocessing(PHY_VARS_NR_UE *UE, } } + if (UE->if_inst) + UE->if_inst->slot_indication(UE->Mod_id, false); + bool dl_slot = false; if (proc->rx_slot_type == NR_DOWNLINK_SLOT || proc->rx_slot_type == NR_MIXED_SLOT) { dl_slot = true; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 530ff952403..a2b2e0f777b 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -49,7 +49,8 @@ NR_UE_DL_BWP_t *get_dl_bwp_structure(NR_UE_MAC_INST_t *mac, int bwp_id, bool set NR_UE_UL_BWP_t *get_ul_bwp_structure(NR_UE_MAC_INST_t *mac, int bwp_id, bool setup); void send_srb0_rrc(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data); -void update_mac_timers(NR_UE_MAC_INST_t *mac); +void update_mac_ul_timers(NR_UE_MAC_INST_t *mac); +void update_mac_dl_timers(NR_UE_MAC_INST_t *mac); NR_LC_SCHEDULING_INFO *get_scheduling_info_from_lcid(NR_UE_MAC_INST_t *mac, NR_LogicalChannelIdentity_t lcid); /**\brief apply default configuration values in nr_mac instance diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index af7e063481a..3eb4c4d3751 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -182,16 +182,23 @@ void handle_time_alignment_timer_expired(NR_UE_MAC_INST_t *mac) // TODO not sure what to do here } -void update_mac_timers(NR_UE_MAC_INST_t *mac) +void update_mac_dl_timers(NR_UE_MAC_INST_t *mac) +{ + bool ra_window_expired = nr_timer_tick(&mac->ra.response_window_timer); + if (ra_window_expired) // consider the Random Access Response reception not successful + nr_rar_not_successful(mac); + bool alignment_timer_expired = nr_timer_tick(&mac->time_alignment_timer); + if (alignment_timer_expired) + handle_time_alignment_timer_expired(mac); +} + +void update_mac_ul_timers(NR_UE_MAC_INST_t *mac) { if (mac->data_inactivity_timer) { bool inactivity_timer_expired = nr_timer_tick(mac->data_inactivity_timer); if (inactivity_timer_expired) nr_mac_rrc_inactivity_timer_ind(mac->ue_id); } - bool alignment_timer_expired = nr_timer_tick(&mac->time_alignment_timer); - if (alignment_timer_expired) - handle_time_alignment_timer_expired(mac); bool contention_resolution_expired = nr_timer_tick(&mac->ra.contention_resolution_timer); if (contention_resolution_expired) nr_ra_contention_resolution_failed(mac); @@ -238,9 +245,6 @@ void update_mac_timers(NR_UE_MAC_INST_t *mac) phr_info->phr_reporting |= (1 << phr_cause_periodic_timer); } } - bool ra_window_expired = nr_timer_tick(&mac->ra.response_window_timer); - if (ra_window_expired) // consider the Random Access Response reception not successful - nr_rar_not_successful(mac); bool ra_backoff_expired = nr_timer_tick(&mac->ra.RA_backoff_timer); if (ra_backoff_expired) { // perform the Random Access Resource selection procedure after the backoff time diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index d3e7a5a9aa0..06eb9f86507 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1329,12 +1329,15 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info) return ret2; } -void nr_ue_slot_indication(uint8_t mod_id) +void nr_ue_slot_indication(uint8_t mod_id, bool is_tx) { NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); int ret = pthread_mutex_lock(&mac->if_mutex); AssertFatal(!ret, "mutex failed %d\n", ret); - update_mac_timers(mac); + if (is_tx) + update_mac_ul_timers(mac); + else + update_mac_dl_timers(mac); ret = pthread_mutex_unlock(&mac->if_mutex); AssertFatal(!ret, "mutex failed %d\n", ret); } diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h index e6a4bfa80b1..2bbd97db843 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h @@ -260,7 +260,7 @@ typedef int (nr_ue_dl_indication_f)(nr_downlink_indication_t *dl_info); */ typedef int (nr_ue_ul_indication_f)(nr_uplink_indication_t *ul_info); -typedef void (nr_ue_slot_indication_f)(uint8_t mod_id); +typedef void (nr_ue_slot_indication_f)(uint8_t mod_id, bool is_tx); /* * Generic type of an application-defined callback to return various -- GitLab