[Epic-ID: ODUHIGH-488][Task-ID: ODUHIGH-501] WG8 Alignment | Ue Sync Status Indication 40/10740/3
authorlal.harshita <Harshita.Lal@radisys.com>
Thu, 16 Mar 2023 10:22:57 +0000 (15:52 +0530)
committerlal.harshita <Harshita.Lal@radisys.com>
Thu, 16 Mar 2023 14:08:16 +0000 (19:38 +0530)
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
Change-Id: I144ebe3b3eae3c1100483cd99c45ac72494e8b42
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
src/5gnrmac/mac_ue_mgr.c
src/cm/du_app_mac_inf.c
src/cm/du_app_mac_inf.h
src/du_app/du_mgr_msg_router.c
src/du_app/du_ue_mgr.c

index 70b1896..99c4e8d 100644 (file)
@@ -55,6 +55,53 @@ MacDuUeResetRspFunc macDuUeResetRspOpts[] =
    DuProcMacUeResetRsp,   /* packing for tightly coupled */
    packDuMacUeResetRsp   /* packing for light weight loosly coupled */
 };
+
+MacDuUeSyncStatusIndFunc macDuUeSyncStatusIndOpts[] =
+{
+   packDuMacUeSyncStatusInd,   /* packing for loosely coupled */
+   DuProcMacUeSyncStatusInd,   /* packing for tightly coupled */
+   packDuMacUeSyncStatusInd    /* packing for light weight loosly coupled */
+};
+
+/*******************************************************************
+*
+* @brief Fill and Send UE Sync Status Indication from MAC to DU APP
+*
+* @details
+*
+*    Function : MacSendUeSyncStatusInd 
+*
+*    Functionality: Fill and Send UE Sync Status Indication from MAC to DUAPP
+*
+* @params[in] uint16_t cellId, uint16_t ueId, SyncStatus status 
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+
+uint8_t MacSendUeSyncStatusInd(uint16_t cellId, uint16_t ueId, SyncStatus  status)
+{
+   MacUeSyncStatusInd *ueSyncStatusInd;
+   Pst            rspPst;
+
+   MAC_ALLOC_SHRABL_BUF(ueSyncStatusInd, sizeof(MacUeSyncStatusInd));
+   if(!ueSyncStatusInd)
+   {
+      DU_LOG("\nERROR  -->  MAC : Memory allocation for UE Sync Status Indication failed");
+      return RFAILED;
+   }
+
+   /* Filling UE Sync Status Indication */
+   ueSyncStatusInd->cellId = cellId;
+   ueSyncStatusInd->ueId   = ueId;
+   ueSyncStatusInd->status = status;
+
+   /* Fill Post structure and send UE Sync Status Indication */
+   memset(&rspPst, 0, sizeof(Pst));
+   FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_UE_SYNC_STATUS_IND);
+   return (*macDuUeSyncStatusIndOpts[rspPst.selector])(&rspPst, ueSyncStatusInd);
+}
+
 /*******************************************************************
  *
  * @brief Fills mac cell group config to be sent to scheduler
@@ -2998,7 +3045,7 @@ uint8_t MacProcSchUeRecfgRsp(Pst *pst, SchUeRecfgRsp *schRecfgRsp)
    uint8_t ret = ROK;
    uint16_t cellIdx;
    MacUeRecfg *ueRecfg = NULLP;
-
+   
 #ifdef CALL_FLOW_DEBUG_LOG
    switch(pst->event)
    {
index c2165da..d5735c8 100644 (file)
@@ -2108,6 +2108,76 @@ uint8_t unpackDuMacUeResetRsp(MacDuUeResetRspFunc func, Pst *pst, Buffer *mBuf)
     return RFAILED;
 }
 
+/*******************************************************************
+ *
+ * @brief Pack and send UE Sync Status Indication from MAC to DU APP
+ *
+ * @details
+ *
+ *    Function : packDuMacUeSyncStatusInd
+ *
+ *    Functionality:
+ *       Pack and send UE Sync Status Indication from MAC to DU APP
+ *
+ * @params[in]
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t packDuMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *SyncStatusInd)
+{
+   Buffer *mBuf = NULLP;
+   
+   if(pst->selector == ODU_SELECTOR_LWLC)
+   {
+      if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
+      {
+         DU_LOG("\nERROR  --> MAC : Memory allocation failed at packDuMacUeSyncStatusInd");
+         return RFAILED;
+      }
+      /* pack the address of the structure */
+      CMCHKPK(oduPackPointer,(PTR)SyncStatusInd, mBuf);
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->  MAC: Only LWLC supported for packDuMacUeSyncStatusInd");
+      return RFAILED;
+   }
+   
+   return ODU_POST_TASK(pst,mBuf);
+}
+
+/*******************************************************************
+*
+* @brief Unpack UE Config Response from MAC to DU APP
+*
+* @details
+*
+*    Function :unpackDuMacUeSyncStatusInd 
+*
+*    Functionality: Unpack UE Config Response from MAC to DU APP
+*
+* @params[in]
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t unpackDuMacUeSyncStatusInd(MacDuUeSyncStatusIndFunc func, Pst *pst, Buffer *mBuf)
+{
+    if(pst->selector == ODU_SELECTOR_LWLC)
+    {
+       MacUeSyncStatusInd *ueSyncStatusInd = NULLP;
+
+       /* unpack the address of the structure */
+       CMCHKUNPK(oduUnpackPointer, (PTR *)&ueSyncStatusInd, mBuf);
+       ODU_PUT_MSG_BUF(mBuf);
+       return (*func)(pst, ueSyncStatusInd);
+    }
+
+    ODU_PUT_MSG_BUF(mBuf);
+    return RFAILED;
+}
+
 /*******************************************************************
  *
  * @brief Searches for first unset bit in ueBitMap
index 5f94ae8..af3b622 100644 (file)
@@ -86,6 +86,7 @@
 #define EVENT_MAC_DL_PCCH_IND        224
 #define EVENT_MAC_UE_RESET_REQ       225
 #define EVENT_MAC_UE_RESET_RSP       226
+#define EVENT_MAC_UE_SYNC_STATUS_IND 227
 
 #define BSR_PERIODIC_TIMER_SF_10 10
 #define BSR_RETX_TIMER_SF_320 320
@@ -100,6 +101,13 @@ typedef enum
    MAC_DU_APP_RSP_OK
 }MacRsp;
 
+typedef enum
+{
+   IN_SYNC,
+   OUT_OF_SYNC,
+   OUT_OF_SUNC_MAX_RETRIES
+}SyncStatus;
+
 typedef enum
 {
    DUP_MODE_FDD,
@@ -1668,6 +1676,13 @@ typedef struct ueResetRsp
    CauseOfResult  status;
 }MacUeResetRsp;
 
+typedef struct ueSyncStatusInd
+{
+   uint16_t   cellId;
+   uint8_t    ueId;
+   SyncStatus status;
+}MacUeSyncStatusInd;
+
 /* Functions for CellUp Ind from MAC to DU APP*/
 typedef uint8_t (*DuMacCellUpInd) ARGS((
         Pst       *pst,
@@ -1810,6 +1825,11 @@ typedef uint8_t (*MacDuUeResetRspFunc) ARGS((
      Pst            *pst,
      MacUeResetRsp *resetRsp));
 
+/* UE sync status indication from MAC to DU APP*/
+typedef uint8_t (*MacDuUeSyncStatusIndFunc) ARGS((
+        Pst            *pst,
+        MacUeSyncStatusInd *syncStatusInd));
+
 uint64_t ueBitMapPerCell[MAX_NUM_CELL]; /* Bit Map to store used/free UE-IDX per Cell */
 
 uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId);
@@ -1896,7 +1916,9 @@ uint8_t unpackMacUeResetReq(DuMacUeResetReq func, Pst *pst, Buffer *mBuf);
 uint8_t packDuMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp);
 uint8_t DuProcMacUeResetRsp(Pst *pst, MacUeResetRsp *resetRsp);
 uint8_t unpackDuMacUeResetRsp(MacDuUeResetRspFunc func, Pst *pst, Buffer *mBuf);
-
+uint8_t packDuMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *ueSyncStatusInd);
+uint8_t DuProcMacUeSyncStatusInd(Pst *pst, MacUeSyncStatusInd *ueSyncStatusInd);
+uint8_t unpackDuMacUeSyncStatusInd(MacDuUeSyncStatusIndFunc func, Pst *pst, Buffer *mBuf);
 #endif
 
 
index 7ab4a8c..2d650e4 100644 (file)
@@ -550,6 +550,11 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf)
                      ret = unpackDuMacSliceCfgRsp(DuProcMacSliceCfgRsp, pst, mBuf);
                      break;
                   }
+               case EVENT_MAC_UE_SYNC_STATUS_IND:
+                  {
+                     ret = unpackDuMacUeSyncStatusInd(DuProcMacUeSyncStatusInd, pst, mBuf);
+                     break;
+                                                                                                }
                case EVENT_MAC_SLICE_RECFG_RSP:
                   {
                      ret = unpackDuMacSliceRecfgRsp(DuProcMacSliceRecfgRsp, pst, mBuf);
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
 ***********************************************************************/