Commit 93f59a3c authored by Robert Schmidt's avatar Robert Schmidt

Remove RA.crnti: it is not needed anymore

The RA.crnti field is marked as being used by NSA mode, but it is not.
OTOH, it is used in the case of RA with Msg.3 with C-RNTI MAC CE. The
latter does not necessarily need it, though, as we can change the RNTI
of the RA process when we receive C-RNTI MAC CE.

This introduces a slight complication, though, as we cannot remove the
MAC UE Context (generated when receiving Msg.3) directly when parsing
the C-RNTI MAC CE. Previously, we had both rnti and crnti in the RA
struct, and when sending Msg.4 after Msg.3 with C-RNTI MAC CE, we would
remove the UE context (this is changed in the next commit). Therefore,
we employ nr_mac_trigger_release_timer() which releases the UE after
60ms, circumventing this complication.
parent 7b7f045f
......@@ -1630,7 +1630,7 @@ static void nr_generate_Msg3_dcch_dtch_response(module_id_t module_idP,
return;
// UE is known by the network, C-RNTI to be used instead of TC-RNTI
int rnti = ra->crnti;
int rnti = ra->rnti;
NR_UE_info_t *UE = find_nr_UE(&nr_mac->UE_info, rnti);
if (!UE) {
......@@ -1731,10 +1731,6 @@ static void nr_generate_Msg3_dcch_dtch_response(module_id_t module_idP,
return;
}
// Remove UE associated to TC-RNTI
mac_remove_nr_ue(nr_mac, ra->rnti);
// If the UE used MSG3 to transfer a DCCH or DTCH message, then contention resolution is successful if the UE receives a PDCCH transmission which has its CRC bits scrambled by the C-RNTI
// Just send padding LCID
uint8_t buf[tb_size];
......@@ -2113,7 +2109,6 @@ void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t
ra->timing_offset = 0;
ra->RRC_timer = 20;
ra->msg3_round = 0;
ra->crnti = 0;
if(ra->cfra == false) {
ra->rnti = 0;
}
......
......@@ -223,7 +223,13 @@ static int nr_process_mac_pdu(instance_t module_idP,
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[i];
if (ra->state >= WAIT_Msg3 && ra->rnti == UE->rnti) {
ra->crnti = ((pduP[1]&0xFF)<<8)|(pduP[2]&0xFF);
// remove UE context just created after Msg.3 in some milliseconds
// as the UE is one already known (not now, as the UE context is
// still needed for the moment)
nr_mac_trigger_release_timer(&UE->UE_sched_ctrl, UE->current_UL_BWP.scs);
//mac_remove_nr_ue(RC.nrmac[module_idP], ra->rnti);
// this UE is the one identified by the RNTI in pduP
ra->rnti = ((pduP[1]&0xFF)<<8)|(pduP[2]&0xFF);
ra->state = Msg3_dcch_dtch;
break;
}
......@@ -779,13 +785,13 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
if (ra->state == Msg3_dcch_dtch) {
// Check if the UE identified by C-RNTI still exists at the gNB
NR_UE_info_t * UE_C = find_nr_UE(&gNB_mac->UE_info, ra->crnti);
NR_UE_info_t * UE_C = find_nr_UE(&gNB_mac->UE_info, ra->rnti);
if (!UE_C) {
// The UE identified by C-RNTI no longer exists at the gNB
// Let's abort the current RA, so the UE will trigger a new RA later but using RRCSetupRequest instead. A better solution may be implemented
mac_remove_nr_ue(gNB_mac, ra->rnti);
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
LOG_W(NR_MAC, "No UE found with C-RNTI %04x, ignoring Msg.3 to have UE come back with new RA attempt\n", ra->crnti);
LOG_W(NR_MAC, "No UE found with C-RNTI %04x, ignoring Msg.3 to have UE come back with new RA attempt\n", ra->rnti);
return;
} else {
// The UE identified by C-RNTI still exists at the gNB
......
......@@ -287,7 +287,7 @@ void ue_context_modification_refuse(const f1ap_ue_context_modif_refuse_t *refuse
NR_COMMON_channels_t *cc = &mac->common_channels[CC_id];
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
NR_RA_t *ra = &cc->ra[i];
if (ra->crnti == UE->rnti)
if (ra->rnti == UE->rnti)
nr_clear_ra_proc(0, CC_id, 0 /* frame */, ra);
}
NR_SCHED_UNLOCK(&mac->sched_lock);
......
......@@ -204,8 +204,6 @@ typedef struct {
NR_CellGroupConfig_t *CellGroup;
/// Preambles for contention-free access
NR_preamble_ue_t preambles;
/// NSA: the UEs C-RNTI to use
rnti_t crnti;
/// CFRA flag
bool cfra;
// BWP for RA
......
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