Fix in new RA attempts after fail
This commit is contained in:
@@ -800,7 +800,7 @@ void nr_ra_failed(uint8_t mod_id, uint8_t CC_id, NR_PRACH_RESOURCES_t *prach_res
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
RA_config_t *ra = &mac->ra;
|
||||
|
||||
ra->first_Msg3 = 0;
|
||||
ra->first_Msg3 = 1;
|
||||
ra->generate_nr_prach = RA_FAILED;
|
||||
ra->ra_state = RA_UE_IDLE;
|
||||
|
||||
|
||||
@@ -2291,7 +2291,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
|
||||
break;
|
||||
}
|
||||
if (rarh->E == 0) {
|
||||
LOG_W(NR_MAC,"[UE %d][RAPROC] Received RAR preamble (%d) doesn't match the intended RAPID (%d)\n", mod_id, rarh->RAPID, preamble_index);
|
||||
LOG_W(NR_MAC,"[UE %d][RAPROC][%d.%d] Received RAR preamble (%d) doesn't match the intended RAPID (%d)\n", mod_id, frame, slot, rarh->RAPID, preamble_index);
|
||||
break;
|
||||
} else {
|
||||
rarh += sizeof(NR_MAC_RAR) + 1;
|
||||
|
||||
@@ -464,9 +464,19 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
UE_scheduling_control->sched_ul_bytes = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!sduP) // check that CRC passed
|
||||
return;
|
||||
} else if(sduP) {
|
||||
|
||||
bool no_sig = true;
|
||||
for (int k = 0; k < sdu_lenP; k++) {
|
||||
if(sduP[k]!=0) {
|
||||
no_sig = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(no_sig) {
|
||||
LOG_W(NR_MAC, "No signal\n");
|
||||
}
|
||||
|
||||
T(T_GNB_MAC_UL_PDU_WITH_DATA, T_INT(gnb_mod_idP), T_INT(CC_idP),
|
||||
T_INT(rntiP), T_INT(frameP), T_INT(slotP), T_INT(-1) /* harq_pid */,
|
||||
@@ -480,47 +490,69 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
if (ra->state != WAIT_Msg3)
|
||||
continue;
|
||||
|
||||
// random access pusch with TC-RNTI
|
||||
if (ra->rnti != current_rnti) {
|
||||
LOG_W(NR_MAC,
|
||||
"expected TC-RNTI %04x to match current RNTI %04x\n",
|
||||
ra->rnti,
|
||||
current_rnti);
|
||||
if(no_sig) {
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state);
|
||||
ra->state = RA_IDLE;
|
||||
ra->timing_offset = 0;
|
||||
ra->RRC_timer = 20;
|
||||
ra->msg3_round = 0;
|
||||
} else {
|
||||
|
||||
// random access pusch with TC-RNTI
|
||||
if (ra->rnti != current_rnti) {
|
||||
LOG_W(NR_MAC,
|
||||
"expected TC-RNTI %04x to match current RNTI %04x\n",
|
||||
ra->rnti,
|
||||
current_rnti);
|
||||
continue;
|
||||
}
|
||||
const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->secondaryCellGroup);
|
||||
UE_info->UE_beam_index[UE_id] = ra->beam_id;
|
||||
LOG_I(NR_MAC,
|
||||
"[gNB %d][RAPROC] PUSCH with TC-RNTI %x received correctly, "
|
||||
"adding UE MAC Context UE_id %d/RNTI %04x\n",
|
||||
gnb_mod_idP,
|
||||
current_rnti,
|
||||
UE_id,
|
||||
ra->rnti);
|
||||
|
||||
LOG_I(NR_MAC,"[RAPROC] RA-Msg3 received\n");
|
||||
LOG_D(NR_MAC,"[RAPROC] Received Msg3:\n");
|
||||
for (int k = 0; k < sdu_lenP; k++) {
|
||||
LOG_D(NR_MAC,"(%i): 0x%x\n",k,sduP[k]);
|
||||
}
|
||||
|
||||
// UE Contention Resolution Identity
|
||||
// Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to fill in Msg4
|
||||
// First byte corresponds to R/LCID MAC sub-header
|
||||
memcpy(ra->cont_res_id, &sduP[1], sizeof(uint8_t) * 6);
|
||||
|
||||
// re-initialize ta update variables afrer RA procedure completion
|
||||
UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP;
|
||||
|
||||
nr_process_mac_pdu(gnb_mod_idP, current_rnti, CC_idP, frameP, sduP, sdu_lenP);
|
||||
|
||||
free(ra->preambles.preamble_list);
|
||||
|
||||
ra->state = Msg4;
|
||||
ra->Msg4_frame = ( frameP +2 ) % 1024;
|
||||
ra->Msg4_slot = 1;
|
||||
LOG_I(MAC, "Scheduling RA-Msg4 for TC-RNTI %04x (state %d, frame %d, slot %d)\n", ra->rnti, ra->state, ra->Msg4_frame, ra->Msg4_slot);
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < NR_NB_RA_PROC_MAX; ++i) {
|
||||
NR_RA_t *ra = &gNB_mac->common_channels[CC_idP].ra[i];
|
||||
if (ra->state != WAIT_Msg3)
|
||||
continue;
|
||||
}
|
||||
const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->secondaryCellGroup);
|
||||
UE_info->UE_beam_index[UE_id] = ra->beam_id;
|
||||
LOG_I(NR_MAC,
|
||||
"[gNB %d][RAPROC] PUSCH with TC-RNTI %x received correctly, "
|
||||
"adding UE MAC Context UE_id %d/RNTI %04x\n",
|
||||
gnb_mod_idP,
|
||||
current_rnti,
|
||||
UE_id,
|
||||
ra->rnti);
|
||||
|
||||
LOG_I(NR_MAC,"[RAPROC] RA-Msg3 received\n");
|
||||
LOG_D(NR_MAC,"[RAPROC] Received Msg3:\n");
|
||||
for (int k = 0; k < sdu_lenP; k++) {
|
||||
LOG_D(NR_MAC,"(%i): 0x%x\n",k,sduP[k]);
|
||||
}
|
||||
|
||||
// UE Contention Resolution Identity
|
||||
// Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to fill in Msg4
|
||||
// First byte corresponds to R/LCID MAC sub-header
|
||||
memcpy(ra->cont_res_id, &sduP[1], sizeof(uint8_t) * 6);
|
||||
|
||||
// re-initialize ta update variables afrer RA procedure completion
|
||||
UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP;
|
||||
|
||||
nr_process_mac_pdu(gnb_mod_idP, current_rnti, CC_idP, frameP, sduP, sdu_lenP);
|
||||
|
||||
free(ra->preambles.preamble_list);
|
||||
|
||||
ra->state = Msg4;
|
||||
ra->Msg4_frame = ( frameP +2 ) % 1024;
|
||||
ra->Msg4_slot = 1;
|
||||
LOG_I(MAC, "Scheduling RA-Msg4 for TC-RNTI %04x (state %d, frame %d, slot %d)\n", ra->rnti, ra->state, ra->Msg4_frame, ra->Msg4_slot);
|
||||
return;
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state);
|
||||
ra->state = RA_IDLE;
|
||||
ra->timing_offset = 0;
|
||||
ra->RRC_timer = 20;
|
||||
ra->msg3_round = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user