Configured cell list changes
[o-du/l2.git] / src / du_app / du_mgr_ex_ms.c
index 6635832..12f63cc 100644 (file)
 ################################################################################
 *******************************************************************************/
 
-/* This file contains message handling functionality for DU cell management */
+/* This file contains message handling functionality for DU APP */
 
-#include "du_mgr.h"
+#include "du_sctp.h"
+#include "du_f1ap_msg_hdl.h"
+#include "du_e2ap_msg_hdl.h"
+#include "lsctp.h"
+#include "legtp.h"
+#include "du_app_mac_inf.h"
+#include "du_ue_mgr.h"
+
+#include "kwu.x"
+
+extern S16 cmUnpkLkwCfgCfm(LkwCfgCfm func,Pst *pst, Buffer *mBuf);
+extern S16 cmUnpkLkwCntrlCfm(LkwCntrlCfm func,Pst *pst, Buffer *mBuf);
+extern S16 cmUnpkLrgCfgCfm(LrgCfgCfm func,Pst *pst, Buffer *mBuf);
 
 /**************************************************************************
  * @brief Task Initiation callback function. 
  ***************************************************************************/
 S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason)
 {
-//TODO: TBD
+   duCb.init.procId  = SFndProcId();
+   duCb.init.ent     = entity;
+   duCb.init.inst    = inst;
+   duCb.init.region  = region;
+   duCb.init.reason  = reason;
+   duCb.init.cfgDone = FALSE;
+   duCb.init.pool    = DU_POOL;
+   duCb.init.acnt    = FALSE;
+   duCb.init.trc     = FALSE;
+   duCb.init.usta    = TRUE;
+   duCb.mem.region   = DFLT_REGION;
+   duCb.mem.pool     = DU_POOL;
+
+   duCb.f1Status     = FALSE;
+   duCb.e2Status     = FALSE;
+
+   memset(duCb.cfgCellLst, '\0', DU_MAX_CELLS * sizeof(duCb.cfgCellLst));
+   memset(duCb.actvCellLst, '\0',DU_MAX_CELLS * sizeof(duCb.actvCellLst));
+
+   SSetProcId(DU_PROC);
 
    return ROK;
 
@@ -80,13 +111,14 @@ S16 duActvTsk(Pst *pst, Buffer *mBuf)
             {
                case EVTCFG:
                   {
+                     DU_LOG("\n****** Received initial configs at DU APP ******\n");
                      duProcCfgComplete();
                      SPutMsg(mBuf);
                      break;
                   }
                default:
                   {
-                     printf("\nInvalid event received at duActvTsk from ENTDUAPP");
+                     DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTDUAPP");
                      SPutMsg(mBuf);
                      ret = RFAILED;
                   }
@@ -94,88 +126,148 @@ S16 duActvTsk(Pst *pst, Buffer *mBuf)
 
             break;
          }
-      case ENTF1AP:
-         {
-
-            break;
-         }
-      case ENTRG: //TODO: Layer cfg for RLC UL, DL and MAC must be done
+      case ENTKW:
          {
             switch(pst->event)
             {
-               //Config complete
-               case EVTCFG:
+               case LKW_EVT_CFG_CFM:
                   {
-                     //TODO: Implement duEstablishSctpToCu();
-                     SPutMsg(mBuf);
+                     ret = cmUnpkLkwCfgCfm(duHdlRlcCfgComplete, pst, mBuf);
+                     break;
+                  }
+               case LKW_EVT_CNTRL_CFM:
+                  {
+                     ret = cmUnpkLkwCntrlCfm(duHdlRlcCntrlCfgComplete, pst, mBuf);
+                     break;
+                  }
+               case LKW_EVT_STA_IND:
+                  {
+                     break;
+                  }
+               case KWU_EVT_DAT_IND:
+                  {
+                     ret = cmUnpkKwuDatInd(duHdlRlcUlData, pst, mBuf);
                      break;
                   }
                default:
                   {
-                     printf("\nInvalid event received at duActvTsk from ENTRG");
+                     DU_LOG("\nDU_APP : Invalid event %d received at duActvTsk from ENTKW", \
+                           pst->event);
                      SPutMsg(mBuf);
                      ret = RFAILED;
                   }
             }
-
             break;
          }
-      case ENTSCTP:
+      case ENTRG:
          {
             switch(pst->event)
             {
-               case EVTSCTPUP:
+               //Config complete
+               case EVTCFG:
                   {
-                     //Setup F1-C
                      SPutMsg(mBuf);
                      break;
                   }
+               case EVTLRGCFGCFM:
+                  {
+                     ret = cmUnpkLrgCfgCfm(duHdlMacCfgComplete, pst, mBuf);
+                     break;
+                  }
+               case EVTLRGCNTRLCFM:
+                  {
+                     break;
+                  }
+               case EVTMACSCHGENCFGCFM:
+                  {
+                     ret = cmUnpkLrgSchCfgCfm(duHdlSchCfgComplete, pst, mBuf);
+                     break;
+                  }
+               case EVENT_MAC_CELL_CONFIG_CFM:
+                  {
+                     ret = unpackMacCellCfgCfm(duHandleMacCellCfgCfm, pst, mBuf);
+                     break;
+                  }
                default:
                   {
-                     printf("\nInvalid event received at duActvTsk from ENTRG");
+                     DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTRG");
                      SPutMsg(mBuf);
                      ret = RFAILED;
                   }
+            }
+
+            break;
+         }
+      case ENTSCTP:
+         {
+            switch(pst->event)
+            {
+               case EVTSCTPDATA:
+               {
+                  F1APMsgHdlr(mBuf);
+                  break;
+               }
+               case EVTSCTPNTFY:
+               {
+                  ret = cmUnpkSctpNtfy(duSctpNtfyHdl, pst, mBuf);
+                  break;
+               }
+               case EVTRICDATA:
+               {
+                  E2APMsgHdlr(mBuf);
+                  break;
+               }
+
+               default:
+               {
+                  DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTSCTP");
+                  ret = RFAILED;
+               }
 
             }
+            SPutMsg(mBuf);
+            break;
+         }
+      case ENTEGTP:
+         {
+            switch(pst->event)
+            {
+               case EVTCFGCFM:
+               {
+                  cmUnpkEgtpCfgCfm(duHdlEgtpCfgComplete, mBuf);
+                  break;
+               }
+               case EVTSRVOPENCFM:
+               {
+                  cmUnpkEgtpSrvOpenCfm(duHdlEgtpSrvOpenComplete, mBuf);
+                  break;
+               }
+               case EVTTNLMGMTCFM:
+               {
+                  cmUnpkEgtpTnlMgmtCfm(duHdlEgtpTnlMgmtCfm, mBuf);
+                  break;
+               }
+               default:
+               {
+                  DU_LOG("\nDU_APP : Invalid event[%d] received at duActvTsk from ENTEGTP", pst->event);
+                  ret = RFAILED;
+               }
+            }
+            SPutMsg(mBuf);
+            break;
          }
       default:
          {
-            printf("\n DU APP can not process message from Entity %d", pst->srcEnt);
+            DU_LOG("\nDU_APP : DU APP can not process message from Entity %d", pst->srcEnt);
             SPutMsg(mBuf);
             ret = RFAILED;
          }
 
    }
-
    SExitTsk();
    return ret;
 }
 
-/**************************************************************************
- * @brief Function to invoke DU Layer Configs
- *
- * @details
- *
- *      Function : duProcCfgComplete 
- * 
- *      Functionality:
- *           Initiates Configs towards layers of DU
- *     
- * @param[in]  void
- * @return ROK     - success
- *         RFAILED - failure
- *
- ***************************************************************************/
-S16 duProcCfgComplete()
-{
-//TBD: invoke SCTP/layer config
-
-//   duHdlRlcUlCfgEvent();
-
-   return ROK;
-}
-
 /**********************************************************************
          End of file
 **********************************************************************/