Commit e850a8ec authored by luis_pereira87's avatar luis_pereira87

Fix initial connection setup when there is Msg4 retransmissions and UE comes...

Fix initial connection setup when there is Msg4 retransmissions and UE comes with a new RA with Msg3 carrying DCCH or DTCH message
parent e7a49141
......@@ -1954,6 +1954,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
// If the UE used MSG3 to transfer a DCCH or DTCH message, then contention resolution is successful upon transmission of PDCCH
LOG_I(NR_MAC, "(ue rnti 0x%04x) CBRA procedure succeeded!\n", ra->rnti);
nr_clear_ra_proc(module_idP, CC_id, frameP, ra);
UE->Msg3_dcch_dtch = true;
UE->Msg4_ACKed = true;
remove_front_nr_list(&sched_ctrl->feedback_dl_harq);
......@@ -1962,6 +1963,20 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
add_tail_nr_list(&sched_ctrl->available_dl_harq, current_harq_pid);
harq->round = 0;
harq->ndi ^= 1;
// Pause scheduling according to:
// 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs
const NR_COMMON_channels_t *common_channels = &RC.nrmac[module_idP]->common_channels[0];
const NR_SIB1_t *sib1 = common_channels->sib1 ? common_channels->sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
const NR_ServingCellConfig_t *servingCellConfig = UE->CellGroup ? UE->CellGroup->spCellConfig->spCellConfigDedicated : NULL;
NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(sched_ctrl->active_bwp,
common_channels->ServingCellConfigCommon,
sib1);
uint32_t delay_ms = servingCellConfig && servingCellConfig->downlinkBWP_ToAddModList ?
NR_RRC_SETUP_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS : NR_RRC_SETUP_DELAY_MS;
sched_ctrl->rrc_processing_timer = (delay_ms << genericParameters->subcarrierSpacing);
LOG_I(NR_MAC, "(%d.%d) Activating RRC processing timer for UE %04x with %d ms\n", frameP, slotP, UE->rnti, delay_ms);
} else {
ra->state = WAIT_Msg4_ACK;
LOG_D(NR_MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state);
......
......@@ -2919,7 +2919,19 @@ void nr_mac_update_timers(module_id_t module_id,
// If needed, update the Dedicated BWP
const int current_bwp_id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0;
const int current_ubwp_id = sched_ctrl->active_ubwp ? sched_ctrl->active_ubwp->bwp_Id : 0;
if (spCellConfigDedicated &&
if (UE->Msg3_dcch_dtch) {
// Must use Initial Downlink BWP when there is RA with Msg3 through DCCH
sched_ctrl->active_bwp = NULL;
if (current_bwp_id != 0) {
LOG_I(NR_MAC, "Changing to Initial DL-BWP\n");
}
// Must use Initial Uplink BWP when there is RA with Msg3 through DCCH
sched_ctrl->active_ubwp = NULL;
if (current_ubwp_id != 0) {
LOG_I(NR_MAC, "Changing to Initial UL-BWP\n");
}
UE->Msg3_dcch_dtch = false;
} else if (spCellConfigDedicated &&
spCellConfigDedicated->downlinkBWP_ToAddModList &&
spCellConfigDedicated->uplinkConfig &&
spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList) {
......
......@@ -717,6 +717,7 @@ typedef struct {
// UE selected beam index
uint8_t UE_beam_index;
bool Msg4_ACKed;
bool Msg3_dcch_dtch;
/// Sched CSI-RS: scheduling decisions
NR_gNB_UCI_STATS_t uci_statS;
float ul_thr_ue;
......
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