[Epic-ID: ODUHIGH-463][Task-ID: ODUHIGH-508] UE context release at Source GNB after...
[o-du/l2.git] / src / cu_stub / cu_f1ap_msg_hdl.c
index 5da2175..573c3f0 100644 (file)
@@ -9846,29 +9846,36 @@ uint8_t procUlRrcMsg(uint32_t duId, F1AP_PDU_t *f1apMsg)
 
                if(duDb->ueCb[duUeF1apId-1].state == UE_HANDOVER_IN_PROGRESS)
                {
-                  uint8_t ueIdx = 0;
-                  uint8_t srcDuId = duDb->ueCb[duUeF1apId-1].hoInfo.srcNodeId;
-                  DuDb *srcDuDb = NULLP;
-
-                  /* In target DU DB, mark UE as active and delete HO info */
-                  duDb->ueCb[duUeF1apId-1].state = UE_ACTIVE;
-                  memset(&duDb->ueCb[duUeF1apId-1].hoInfo, 0, sizeof(HandoverInfo));
-
-                  /* Release UE context in source DU because the UE is now
-                   * attached to target DU */
-                  SEARCH_DU_DB(duIdx, srcDuId, srcDuDb);
-                  for(ueIdx = 0; ueIdx < srcDuDb->numUe; ueIdx++)
+                  if(duDb->ueCb[duUeF1apId-1].hoInfo.HOType == Inter_DU_HO)
                   {
-                     if(srcDuDb->ueCb[ueIdx].gnbCuUeF1apId == cuUeF1apId)
+                     uint8_t ueIdx = 0;
+                     uint8_t srcDuId = duDb->ueCb[duUeF1apId-1].hoInfo.srcNodeId;
+                     DuDb *srcDuDb = NULLP;
+
+                     /* Release UE context in source DU because the UE is now
+                      * attached to target DU */
+                     SEARCH_DU_DB(duIdx, srcDuId, srcDuDb);
+                     for(ueIdx = 0; ueIdx < srcDuDb->numUe; ueIdx++)
                      {
-                        ret = BuildAndSendUeContextReleaseCommand(srcDuId, srcDuDb->ueCb[ueIdx].gnbCuUeF1apId, srcDuDb->ueCb[ueIdx].gnbDuUeF1apId); 
-                        if(ret != ROK)
+                        if(srcDuDb->ueCb[ueIdx].gnbCuUeF1apId == cuUeF1apId)
                         {
-                           DU_LOG("\nINFO  -->  F1AP: Failed to build and send UE context release command to source DU Id [%d]", srcDuId);
+                           ret = BuildAndSendUeContextReleaseCommand(srcDuId, srcDuDb->ueCb[ueIdx].gnbCuUeF1apId, srcDuDb->ueCb[ueIdx].gnbDuUeF1apId); 
+                           if(ret != ROK)
+                           {
+                              DU_LOG("\nINFO  -->  F1AP: Failed to build and send UE context release command to source DU Id [%d]", srcDuId);
+                           }
+                           break;
                         }
-                        break;
                      }
                   }
+                  else 
+                  {
+                     BuildAndSendUeContextRelease(&duDb->ueCb[duUeF1apId-1]);
+                  }
+
+                  /* In target DU DB, mark UE as active and delete HO info */
+                  duDb->ueCb[duUeF1apId-1].state = UE_ACTIVE;
+                  memset(&duDb->ueCb[duUeF1apId-1].hoInfo, 0, sizeof(HandoverInfo));
                   return ret;
                }
                break;