RRC: Improve UE context lookup for re-establishment on different DU
Add intermediate fallback to rrc_gNB_get_ue_context_by_rnti_any_du() in re-establishment request handling to better handle cases where UE re-establishes on a different DU. RNTI is NOT globally unique - different DUs can assign the same RNTI to different UEs. The assoc_id check in rrc_gNB_get_ue_context_by_rnti() disambiguates RNTI across DUs and prevents returning the wrong UE. However, during re-establishment on a different DU, du_assoc_id hasn't been updated yet (message comes from new DU, but ue_data.du_assoc_id still points to old DU), causing the primary lookup to fail even though the UE exists. The lookup now uses a three-tier fallback: 1. Primary: rrc_gNB_get_ue_context_by_rnti() with assoc_id check (normal case: same DU) 2. Fallback 1: rrc_gNB_get_ue_context_by_rnti_any_du() by RNTI only (re-establishment on different DU) 3. Fallback 2: rrc_gNB_get_ue_context_source_cell() using physCellId (handover scenarios)
This commit is contained in:
@@ -1510,12 +1510,18 @@ static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc,
|
||||
goto fallback_rrc_setup;
|
||||
}
|
||||
|
||||
// Try to find UE context by RNTI and assoc_id (normal case: same DU)
|
||||
ue_context_p = rrc_gNB_get_ue_context_by_rnti(rrc, assoc_id, old_rnti);
|
||||
if (ue_context_p == NULL) {
|
||||
ue_context_p = rrc_gNB_get_ue_context_source_cell(rrc, physCellId, old_rnti);
|
||||
// Fallback 1: Try to find UE by RNTI only (re-establishment on different DU scenario)
|
||||
ue_context_p = rrc_gNB_get_ue_context_by_rnti_any_du(rrc, old_rnti);
|
||||
if (ue_context_p == NULL) {
|
||||
LOG_E(NR_RRC, "NR_RRCReestablishmentRequest without UE context, fallback to RRC setup\n");
|
||||
goto fallback_rrc_setup;
|
||||
// Fallback 2: Try to find UE by source cell (handover scenario)
|
||||
ue_context_p = rrc_gNB_get_ue_context_source_cell(rrc, physCellId, old_rnti);
|
||||
if (ue_context_p == NULL) {
|
||||
LOG_E(NR_RRC, "NR_RRCReestablishmentRequest without UE context, fallback to RRC setup\n");
|
||||
goto fallback_rrc_setup;
|
||||
}
|
||||
}
|
||||
}
|
||||
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
||||
|
||||
Reference in New Issue
Block a user