[Epic-ID: ODUHIGH-488][Task-ID: ODUHIGH-501] WG8 Alignment | Ue Sync Status Indication
[o-du/l2.git] / src / du_app / du_ue_mgr.c
index e37ea0b..f501127 100644 (file)
@@ -4169,6 +4169,74 @@ uint8_t DuProcMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp)
    return ret;
 }
 
+/*******************************************************************
+*
+* @brief Handle UE sync status indication from MAC
+*
+* @details
+*
+*    Function : DuProcMacUeSyncStatusInd
+*
+*    Functionality: Handle UE sync status indication from MAC
+*
+* @params[in] Pointer to MacUeSyncStatusInd and Pst
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+
+uint8_t DuProcMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *ueSyncStatusInd)
+{
+   uint8_t  ret =RFAILED;
+   uint16_t cellIdx=0, crnti = 0;
+   char *status;
+
+   if(ueSyncStatusInd)
+   {
+      GET_CELL_IDX(ueSyncStatusInd->cellId, cellIdx);
+      if(duCb.actvCellLst[cellIdx])
+      {
+         GET_CRNTI(crnti, ueSyncStatusInd->ueId);
+         if(duCb.actvCellLst[cellIdx]->ueCb[ueSyncStatusInd->ueId-1].crnti == crnti)
+         {
+            switch(ueSyncStatusInd->status)
+            {
+               case IN_SYNC:
+                  status = "IN_SYNC";
+                  break;
+
+               case OUT_OF_SYNC:
+                  status = "OUT_OF_SYNC";
+                  break;
+
+               case OUT_OF_SUNC_MAX_RETRIES:
+                  status = "OUT_OF_SUNC_MAX_RETRIES";
+                  break;
+
+               default:
+                  status = "INVALID";
+                  break;
+                  
+            }
+            DU_LOG("\nINFO  -->   DU APP : MAC UE sync status for received UeId %d is %s", ueSyncStatusInd->ueId,status);
+         }
+         else
+         {
+            DU_LOG("\nERROR  -->  DU APP : DuProcMacUeSyncStatusInd(): MAC UE sync status indication : Ue Id [%d] not found",ueSyncStatusInd->cellId);
+         }
+      }
+      else
+      {
+         DU_LOG("\nERROR  -->  DU APP : DuProcMacUeSyncStatusInd(): MAC UE sync status indication : Cell Id [%d] not found",ueSyncStatusInd->cellId);
+      }
+      DU_FREE_SHRABL_BUF(pst->region, pst->pool, ueSyncStatusInd, sizeof(MacUeSyncStatusInd));
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->  DU APP : DuProcMacUeSyncStatusInd(): MAC UE sync status indication is null");
+   }
+   return ret;
+}
 /**********************************************************************
   End of file
 ***********************************************************************/