|
|
|
@@ -457,18 +457,27 @@ void nr_Msg1_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint
|
|
|
|
|
ra->RA_attempt_number++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint8_t gNB_id){
|
|
|
|
|
void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, slot_t slotP, uint8_t gNB_id){
|
|
|
|
|
|
|
|
|
|
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
|
|
|
|
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (mac->scc) ?
|
|
|
|
|
RA_config_t *ra = &mac->ra;
|
|
|
|
|
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = (mac->scc) ?
|
|
|
|
|
mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup:
|
|
|
|
|
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup;
|
|
|
|
|
RA_config_t *ra = &mac->ra;
|
|
|
|
|
long mu = (mac->scc) ?
|
|
|
|
|
mac->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing :
|
|
|
|
|
mac->scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
|
|
|
|
|
int subframes_per_slot = nr_slots_per_frame[mu]/10;
|
|
|
|
|
|
|
|
|
|
LOG_D(MAC,"In %s: [UE %d] Frame %d, CB-RA: starting contention resolution timer\n", __FUNCTION__, mod_id, frameP);
|
|
|
|
|
// start contention resolution timer (cnt in slots)
|
|
|
|
|
int RA_contention_resolution_timer_subframes = (nr_rach_ConfigCommon->ra_ContentionResolutionTimer + 1) * 8;
|
|
|
|
|
|
|
|
|
|
ra->RA_contention_resolution_target_frame = frameP + (RA_contention_resolution_timer_subframes/10);
|
|
|
|
|
ra->RA_contention_resolution_target_slot = (slotP + (RA_contention_resolution_timer_subframes * subframes_per_slot)) % nr_slots_per_frame[mu];
|
|
|
|
|
|
|
|
|
|
LOG_D(MAC,"In %s: [UE %d] CB-RA: starting contention resolution timer set in frame.slot %d.%d and expiring in %d.%d\n",
|
|
|
|
|
__FUNCTION__, mod_id, frameP, slotP, ra->RA_contention_resolution_target_frame, ra->RA_contention_resolution_target_slot);
|
|
|
|
|
|
|
|
|
|
// start contention resolution timer
|
|
|
|
|
ra->RA_contention_resolution_cnt = (nr_rach_ConfigCommon->ra_ContentionResolutionTimer + 1) * 8;
|
|
|
|
|
ra->RA_contention_resolution_timer_active = 1;
|
|
|
|
|
ra->ra_state = WAIT_CONTENTION_RESOLUTION;
|
|
|
|
|
|
|
|
|
@@ -736,20 +745,15 @@ void nr_ue_contention_resolution(module_id_t module_id, int cc_id, frame_t frame
|
|
|
|
|
RA_config_t *ra = &mac->ra;
|
|
|
|
|
|
|
|
|
|
if (ra->RA_contention_resolution_timer_active == 1) {
|
|
|
|
|
|
|
|
|
|
ra->RA_contention_resolution_cnt--;
|
|
|
|
|
|
|
|
|
|
LOG_D(MAC, "In %s: [%d.%d] RA contention resolution timer %d\n", __FUNCTION__, frame, slot, ra->RA_contention_resolution_cnt);
|
|
|
|
|
|
|
|
|
|
if (ra->RA_contention_resolution_cnt == 0) {
|
|
|
|
|
ra->t_crnti = 0;
|
|
|
|
|
ra->RA_active = 0;
|
|
|
|
|
ra->RA_contention_resolution_timer_active = 0;
|
|
|
|
|
// Signal PHY to quit RA procedure
|
|
|
|
|
LOG_E(MAC, "[UE %d] CB-RA: Contention resolution timer has expired, RA procedure has failed...\n", module_id);
|
|
|
|
|
nr_ra_failed(module_id, cc_id, prach_resources, frame, slot);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (frame >= ra->RA_contention_resolution_target_frame &&
|
|
|
|
|
slot >= ra->RA_contention_resolution_target_frame) {
|
|
|
|
|
ra->t_crnti = 0;
|
|
|
|
|
ra->RA_active = 0;
|
|
|
|
|
ra->RA_contention_resolution_timer_active = 0;
|
|
|
|
|
// Signal PHY to quit RA procedure
|
|
|
|
|
LOG_E(MAC, "[UE %d] CB-RA: Contention resolution timer has expired, RA procedure has failed...\n", module_id);
|
|
|
|
|
nr_ra_failed(module_id, cc_id, prach_resources, frame, slot);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -773,7 +777,6 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot){
|
|
|
|
|
|
|
|
|
|
LOG_I(MAC, "[UE %d][%d.%d][RAPROC] RA procedure succeeded. CB-RA: Contention Resolution is successful.\n", mod_id, frame, slot);
|
|
|
|
|
|
|
|
|
|
ra->RA_contention_resolution_cnt = -1;
|
|
|
|
|
ra->RA_contention_resolution_timer_active = 0;
|
|
|
|
|
mac->crnti = ra->t_crnti;
|
|
|
|
|
ra->t_crnti = 0;
|
|
|
|
|