[Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-427] Changes in Ue Context Release Command...
[o-du/l2.git] / src / du_app / du_ue_mgr.c
index f021200..b18ee5e 100644 (file)
@@ -3268,50 +3268,44 @@ void deleteRlcUeCfg(RlcUeCfg *ueCfg)
 *         RFAILED - failure
 *
 * ****************************************************************/
-uint8_t duProcUeContextReleaseCommand(DuUeCb *duUeCb)
+uint8_t duProcUeContextReleaseCommand(uint16_t cellId, DuUeCb *duUeCb)
 {
    uint8_t ret =ROK, ueId=0;
-   uint16_t cellId=0,crnti =0;
-   if(duUeCb == NULLP)
-   {
-      DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand() : duUeCb is null");
-      return RFAILED;
-   }
-   if(duUeCb->f1UeDb == NULLP)
-   {
-      DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand() : f1UeDb is null");
-      return RFAILED;
-   }
-   
-   cellId = duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->cellId;
-   crnti = duUeCb->crnti;
-   GET_UE_ID(crnti, ueId);
-   
-   /* Send DL RRC msg for RRC release */
-   if(duUeCb->f1UeDb->dlRrcMsg)
+   uint16_t crnti = 0;
+
+   if(duUeCb != NULLP)
    {
-      if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu != NULLP)
+      crnti = duUeCb->crnti;
+      GET_UE_ID(crnti, ueId);
+      
+      if(duUeCb->f1UeDb)
       {
-         ret = duBuildAndSendDlRrcMsgToRlc(cellId, duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->ueCb[ueId-1].rlcUeCfg,\
-               duUeCb->f1UeDb->dlRrcMsg);
-         if(ret == RFAILED)
+         /* Send DL RRC msg for RRC release */
+         if(duUeCb->f1UeDb->dlRrcMsg)
          {
-            DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand() : Failed to send DL RRC msg");
-            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
-                  duUeCb->f1UeDb->dlRrcMsg->rrcMsgSize);
-            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+            if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu != NULLP)
+            {
+               ret = duBuildAndSendDlRrcMsgToRlc(cellId, duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->ueCb[ueId-1].rlcUeCfg,\
+                     duUeCb->f1UeDb->dlRrcMsg);
+               if(ret == RFAILED)
+               {
+                  DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand() : Failed to send DL RRC msg");
+                  DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
+                        duUeCb->f1UeDb->dlRrcMsg->rrcMsgSize);
+                  DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+               }
+            }
          }
       }
-   }
-   else
-   {
-      ret = duBuildAndSendUeDeleteReq(cellId,crnti);
-      if(ret == RFAILED)
+      else
       {
-         DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand(): Failed to build and send Ue Delete request");
+         ret = duBuildAndSendUeDeleteReq(cellId,crnti);
+         if(ret == RFAILED)
+         {
+            DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand(): Failed to build and send Ue Delete request");
+         }
       }
    }
-
    return ret;
 }