From 1c07afbeb6f365097025116a65258498a7003b1f Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@openairinterface.org>
Date: Fri, 21 Jul 2023 16:17:46 +0200
Subject: [PATCH] RRC: Remove checks for UEs with existing RNTI

The RRC gives its own RRC UE ID. It won't intervene if DUs assign the same RNTI to different UEs: it simply does not care what the DUs do with the RNTI.
---
 openair2/RRC/NR/rrc_gNB.c            |  8 ++------
 openair2/RRC/NR/rrc_gNB_UE_context.c | 11 +----------
 2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c
index d168ae6b4c9..31378165108 100644
--- a/openair2/RRC/NR/rrc_gNB.c
+++ b/openair2/RRC/NR/rrc_gNB.c
@@ -1525,13 +1525,9 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r
 
       case NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest:
         LOG_D(NR_RRC, "Received RRCSetupRequest on UL-CCCH-Message (UE rnti %04x)\n", rnti);
-        rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(gnb_rrc_inst, rnti);
-        /* TODO this check is wrong, on different DUs there can be the same RNTI, this should not matter for us */
-        if (ue_context_p != NULL) {
-          LOG_W(NR_RRC, "Got RRC setup request for a already registered RNTI %x, dropping the old one and give up this rrcSetupRequest\n", ue_context_p->ue_context.rnti);
-          rrc_gNB_remove_ue_context(gnb_rrc_inst, ue_context_p);
-        } else {
+        {
           rrcSetupRequest = &ul_ccch_msg->message.choice.c1->choice.rrcSetupRequest->rrcSetupRequest;
+          rrc_gNB_ue_context_t *ue_context_p = NULL;
           if (NR_InitialUE_Identity_PR_randomValue == rrcSetupRequest->ue_Identity.present) {
             /* randomValue                         BIT STRING (SIZE (39)) */
             if (rrcSetupRequest->ue_Identity.choice.randomValue.size != 5) { // 39-bit random value
diff --git a/openair2/RRC/NR/rrc_gNB_UE_context.c b/openair2/RRC/NR/rrc_gNB_UE_context.c
index aabcbbf44d6..e73375fb652 100644
--- a/openair2/RRC/NR/rrc_gNB_UE_context.c
+++ b/openair2/RRC/NR/rrc_gNB_UE_context.c
@@ -173,16 +173,7 @@ rrc_gNB_ue_context_t *rrc_gNB_create_ue_context(rnti_t rnti,
                                                 uint32_t du_ue_id)
 //-----------------------------------------------------------------------------
 {
-  rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(rrc_instance_pP, rnti);
-
-  /* TODO: this should not matter, we can have multiple UEs at different DUs
-   * with the same RNTI! */
-  if (ue_context_p) {
-    LOG_E(NR_RRC, "Cannot create new UE context, already exist rnti: %04x\n", rnti);
-    return ue_context_p;
-  }
-
-  ue_context_p = rrc_gNB_allocate_new_ue_context(rrc_instance_pP);
+  rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_allocate_new_ue_context(rrc_instance_pP);
   if (ue_context_p == NULL)
     return NULL;
 
-- 
GitLab