Commit 20fa7319 authored by Robert Schmidt's avatar Robert Schmidt

Use NR_timer_t for UE transmission stop, e.g., RRC processing

Refactor the RRC processing timer to be a generic "transmission stop"
timer, and use NR_timer_t for it.

The gNB MAC might need to stop transmission either for some time (RRC
processing), or continuously (transmission stop requested by CU). Those
can be handled in one common timer implementation. The continuous case
will be used in a follow-up commit.
parent e6643c2f
...@@ -1479,7 +1479,8 @@ static void nr_generate_Msg2(module_id_t module_idP, ...@@ -1479,7 +1479,8 @@ static void nr_generate_Msg2(module_id_t module_idP,
? NR_RRC_SETUP_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS ? NR_RRC_SETUP_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS
: NR_RRC_SETUP_DELAY_MS; : NR_RRC_SETUP_DELAY_MS;
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
sched_ctrl->rrc_processing_timer = (delay_ms << ra->DL_BWP.scs); nr_timer_setup(&sched_ctrl->transmission_stop, delay_ms << ra->DL_BWP.scs, 1);
nr_timer_start(&sched_ctrl->transmission_stop);
} }
} }
......
...@@ -334,9 +334,8 @@ static void nr_store_dlsch_buffer(module_id_t module_id, frame_t frame, sub_fram ...@@ -334,9 +334,8 @@ static void nr_store_dlsch_buffer(module_id_t module_id, frame_t frame, sub_fram
const int lcid = c->lcid; const int lcid = c->lcid;
const uint16_t rnti = UE->rnti; const uint16_t rnti = UE->rnti;
LOG_D(NR_MAC, "In %s: UE %x: LCID %d\n", __FUNCTION__, rnti, lcid); LOG_D(NR_MAC, "In %s: UE %x: LCID %d\n", __FUNCTION__, rnti, lcid);
if (lcid == DL_SCH_LCID_DTCH && sched_ctrl->rrc_processing_timer > 0) { if (lcid == DL_SCH_LCID_DTCH && nr_timer_is_active(&sched_ctrl->transmission_stop))
continue; continue;
}
start_meas(&RC.nrmac[module_id]->rlc_status_ind); start_meas(&RC.nrmac[module_id]->rlc_status_ind);
sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id, sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id,
rnti, rnti,
......
...@@ -2729,9 +2729,8 @@ void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, int n_slo ...@@ -2729,9 +2729,8 @@ void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, int n_slo
if (UE_info->sched_csirs & (1 << dl_bwp->bwp_id)) if (UE_info->sched_csirs & (1 << dl_bwp->bwp_id))
continue; continue;
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
if (sched_ctrl->rrc_processing_timer > 0) { if (nr_timer_is_active(&sched_ctrl->transmission_stop))
continue; continue;
}
if (!UE->sc_info.csi_MeasConfig) if (!UE->sc_info.csi_MeasConfig)
continue; continue;
...@@ -2993,7 +2992,8 @@ int nr_mac_enable_ue_rrc_processing_timer(gNB_MAC_INST *mac, NR_UE_info_t *UE, b ...@@ -2993,7 +2992,8 @@ int nr_mac_enable_ue_rrc_processing_timer(gNB_MAC_INST *mac, NR_UE_info_t *UE, b
int delay = NR_RRC_RECONFIGURATION_DELAY_MS; int delay = NR_RRC_RECONFIGURATION_DELAY_MS;
NR_SubcarrierSpacing_t scs = UE->current_UL_BWP.scs; NR_SubcarrierSpacing_t scs = UE->current_UL_BWP.scs;
UE->UE_sched_ctrl.rrc_processing_timer = (delay << scs) + sl_ahead; nr_timer_setup(&UE->UE_sched_ctrl.transmission_stop, (delay << scs) + sl_ahead, 1);
nr_timer_start(&UE->UE_sched_ctrl.transmission_stop);
UE->apply_cellgroup = apply_cellgroup; UE->apply_cellgroup = apply_cellgroup;
AssertFatal(!UE->apply_cellgroup || (UE->apply_cellgroup && UE->reconfigCellGroup), AssertFatal(!UE->apply_cellgroup || (UE->apply_cellgroup && UE->reconfigCellGroup),
"logic bug: apply_cellgroup %d and UE->reconfigCellGroup %p: did you try to apply a cellGroup, while none is deposited?\n", "logic bug: apply_cellgroup %d and UE->reconfigCellGroup %p: did you try to apply a cellGroup, while none is deposited?\n",
...@@ -3062,10 +3062,10 @@ void nr_mac_update_timers(module_id_t module_id, ...@@ -3062,10 +3062,10 @@ void nr_mac_update_timers(module_id_t module_id,
/* check if UL failure and trigger release request if necessary */ /* check if UL failure and trigger release request if necessary */
nr_mac_check_ul_failure(mac, UE->rnti, sched_ctrl); nr_mac_check_ul_failure(mac, UE->rnti, sched_ctrl);
if (sched_ctrl->rrc_processing_timer > 0) { if (nr_timer_tick(&sched_ctrl->transmission_stop)) {
sched_ctrl->rrc_processing_timer--; /* expired */
if (sched_ctrl->rrc_processing_timer == 0) nr_timer_stop(&sched_ctrl->transmission_stop);
nr_mac_apply_cellgroup(mac, UE, frame, slot); nr_mac_apply_cellgroup(mac, UE, frame, slot);
} }
} }
} }
......
...@@ -532,7 +532,7 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot) ...@@ -532,7 +532,7 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot)
sched_ctrl->sched_srs.srs_scheduled = false; sched_ctrl->sched_srs.srs_scheduled = false;
} }
if ((sched_ctrl->ul_failure && !get_softmodem_params()->phy_test) || sched_ctrl->rrc_processing_timer > 0) { if ((sched_ctrl->ul_failure && !get_softmodem_params()->phy_test) || nr_timer_is_active(&sched_ctrl->transmission_stop)) {
continue; continue;
} }
......
...@@ -223,7 +223,7 @@ void nr_csi_meas_reporting(int Mod_idP, ...@@ -223,7 +223,7 @@ void nr_csi_meas_reporting(int Mod_idP,
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
NR_UE_UL_BWP_t *ul_bwp = &UE->current_UL_BWP; NR_UE_UL_BWP_t *ul_bwp = &UE->current_UL_BWP;
const int n_slots_frame = nr_slots_per_frame[ul_bwp->scs]; const int n_slots_frame = nr_slots_per_frame[ul_bwp->scs];
if ((sched_ctrl->rrc_processing_timer > 0) || (sched_ctrl->ul_failure && !get_softmodem_params()->phy_test)) { if (nr_timer_is_active(&sched_ctrl->transmission_stop) || (sched_ctrl->ul_failure && !get_softmodem_params()->phy_test)) {
continue; continue;
} }
const NR_CSI_MeasConfig_t *csi_measconfig = UE->sc_info.csi_MeasConfig; const NR_CSI_MeasConfig_t *csi_measconfig = UE->sc_info.csi_MeasConfig;
...@@ -1370,7 +1370,7 @@ void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, sub_frame_t slot) ...@@ -1370,7 +1370,7 @@ void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, sub_frame_t slot)
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
NR_UE_UL_BWP_t *ul_bwp = &UE->current_UL_BWP; NR_UE_UL_BWP_t *ul_bwp = &UE->current_UL_BWP;
const int n_slots_frame = nr_slots_per_frame[ul_bwp->scs]; const int n_slots_frame = nr_slots_per_frame[ul_bwp->scs];
if (sched_ctrl->ul_failure || sched_ctrl->rrc_processing_timer > 0) if (sched_ctrl->ul_failure || nr_timer_is_active(&sched_ctrl->transmission_stop))
continue; continue;
NR_PUCCH_Config_t *pucch_Config = ul_bwp->pucch_Config; NR_PUCCH_Config_t *pucch_Config = ul_bwp->pucch_Config;
......
...@@ -1804,7 +1804,7 @@ static void pf_ul(module_id_t module_id, ...@@ -1804,7 +1804,7 @@ static void pf_ul(module_id_t module_id,
const bool do_sched = nr_UE_is_to_be_scheduled(scc, 0, UE, sched_pusch->frame, sched_pusch->slot, nrmac->ulsch_max_frame_inactivity); const bool do_sched = nr_UE_is_to_be_scheduled(scc, 0, UE, sched_pusch->frame, sched_pusch->slot, nrmac->ulsch_max_frame_inactivity);
LOG_D(NR_MAC,"pf_ul: do_sched UE %04x => %s\n",UE->rnti,do_sched ? "yes" : "no"); LOG_D(NR_MAC,"pf_ul: do_sched UE %04x => %s\n",UE->rnti,do_sched ? "yes" : "no");
if ((B == 0 && !do_sched) || (sched_ctrl->rrc_processing_timer > 0)) { if ((B == 0 && !do_sched) || nr_timer_is_active(&sched_ctrl->transmission_stop)) {
continue; continue;
} }
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <string.h> #include <string.h>
#include <pthread.h> #include <pthread.h>
#include "common/utils/ds/seq_arr.h" #include "common/utils/ds/seq_arr.h"
#include "common/utils/nr/nr_common.h"
#define NR_SCHED_LOCK(lock) \ #define NR_SCHED_LOCK(lock) \
do { \ do { \
...@@ -640,8 +641,8 @@ typedef struct { ...@@ -640,8 +641,8 @@ typedef struct {
NR_list_t retrans_ul_harq; NR_list_t retrans_ul_harq;
NR_UE_mac_ce_ctrl_t UE_mac_ce_ctrl; // MAC CE related information NR_UE_mac_ce_ctrl_t UE_mac_ce_ctrl; // MAC CE related information
/// Timer for RRC processing procedures /// Timer for RRC processing procedures and transmission activity
uint32_t rrc_processing_timer; NR_timer_t transmission_stop;
/// sri, ul_ri and tpmi based on SRS /// sri, ul_ri and tpmi based on SRS
nr_srs_feedback_t srs_feedback; nr_srs_feedback_t srs_feedback;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment