msg3 and msg4 changes 82/3982/4
authorBalaji Shankaran <balaji.shankaran@radisys.com>
Wed, 3 Jun 2020 18:58:59 +0000 (00:28 +0530)
committerBalaji Shankaran <balaji.shankaran@radisys.com>
Sat, 6 Jun 2020 10:00:02 +0000 (15:30 +0530)
Change-Id: I326fbb51bf22d4a769e046d898e416001fb6e2b1
Signed-off-by: Balaji Shankaran <balaji.shankaran@radisys.com>
17 files changed:
src/5gnrmac/mac.h
src/5gnrmac/mac_msg_hdl.c
src/5gnrmac/mac_upr_inf_api.c
src/5gnrmac/mac_upr_inf_api.h
src/5gnrmac/rg_ex_ms.c
src/5gnrmac/rg_lmm.c
src/cm/du_app_mac_inf.c
src/cm/du_app_mac_inf.h
src/du_app/du_cell_mgr.c
src/du_app/du_cfg.h
src/du_app/du_f1ap_msg_hdl.c
src/du_app/du_f1ap_msg_hdl.h
src/du_app/du_mgr.h
src/du_app/du_mgr_ex_ms.c
src/du_app/du_msg_hdl.c
src/du_app/du_ue_mgr.c
src/du_app/du_ue_mgr.h

index 6af82e3..2b104df 100644 (file)
@@ -96,7 +96,7 @@ typedef struct macCb
 }MacCb;
 
 /* global variable */
-EXTERN MacCb macCb;
+MacCb macCb;
 void fillMacToSchPst(Pst *pst);
 void fillRarPdu(RarInfo *rarInfo);
 int unpackRxData(SlotIndInfo timingInfo, RxDataIndPdu *rxDataIndPdu);
index 9458930..b9df6b0 100644 (file)
 #include "crg.x"
 #include "rg_prg.x"
 #include "du_app_mac_inf.h"
+#include "mac_upr_inf_api.h"
 #include "rg.x"
 #include "lwr_mac_fsm.h"
 #include "mac.h"
 
 /* This file contains message handling functionality for MAC */
 
+extern MacCb  macCb;
+
 extern void sendToLowerMac(uint16_t msgType, uint32_t msgLen, void *msg);
 
 /* Function pointer for sending crc ind from MAC to SCH */
@@ -263,6 +266,96 @@ uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo)
    return ROK;
 }
 
+/*******************************************************************
+ *
+ * @brief Handles DL CCCH Ind from DU APP
+ *
+ * @details
+ *
+ *    Function : MacHdlDlCcchInd 
+ *
+ *    Functionality:
+ *      Handles DL CCCH Ind from DU APP
+ *
+ * @params[in] Post structure pointer
+ *             DL CCCH Ind pointer 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t MacHdlDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
+{
+   DU_LOG("\nMAC : Handling DL CCCH IND");
+
+       MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlCcchIndInfo->dlCcchMsg, strlen((const char*)dlCcchIndInfo->dlCcchMsg));
+       MAC_FREE_SHRABL_BUF(pst->region, pst->pool, dlCcchIndInfo, sizeof(DlCcchIndInfo));
+   return ROK;
+
+}
+
+/*******************************************************************
+ *
+ * @brief Sends UL CCCH Ind to DU APP
+ *
+ * @details
+ *
+ *    Function : macSendUlCcchInd
+ *
+ *    Functionality:
+ *        MAC sends UL CCCH Ind to DU APP
+ *
+ * @params[in] Post structure pointer
+ *            
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t macSendUlCcchInd(uint8_t *rrcContainer, uint16_t cellId, uint16_t crnti)
+{
+   Pst pst;
+       uint8_t ret = ROK;
+   UlCcchIndInfo *ulCcchIndInfo = NULLP;
+
+   MAC_ALLOC_SHRABL_BUF(ulCcchIndInfo, sizeof(UlCcchIndInfo));
+   if(!ulCcchIndInfo)
+   {
+               DU_LOG("\nMAC: Memory failed in macSendUlCcchInd");
+               return RFAILED;
+       }
+
+       ulCcchIndInfo->cellId = cellId;
+       ulCcchIndInfo->crnti  = crnti;
+       ulCcchIndInfo->ulCcchMsg = rrcContainer;
+
+       /* Fill Pst */
+       pst.selector  = DU_MAC_LWLC;
+       pst.srcEnt    = ENTRG;
+       pst.dstEnt    = ENTDUAPP;
+       pst.dstInst   = 0;
+       pst.srcInst   = macCb.macInst;
+       pst.dstProcId = rgCb[pst.srcInst].rgInit.procId;
+       pst.srcProcId = rgCb[pst.srcInst].rgInit.procId;
+       pst.region    = MAC_MEM_REGION;
+       pst.pool      = MAC_POOL;
+       pst.event     = EVENT_MAC_UL_CCCH_IND;
+       pst.route     = 0;
+       pst.prior     = 0;
+       pst.intfVer   = 0;
+
+       if(MacDuAppUlCcchInd(&pst, ulCcchIndInfo) != ROK)
+       {
+               DU_LOG("\nMAC: Failed to send UL CCCH Ind to DU APP");
+               MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo->ulCcchMsg,
+                               strlen((const char*)ulCcchIndInfo->ulCcchMsg));
+               MAC_FREE_SHRABL_BUF(MAC_MEM_REGION, MAC_POOL, ulCcchIndInfo, sizeof(UlCcchIndInfo));
+               ret = RFAILED;
+       }
+       return ret;
+}
+
+
+
+
 /**********************************************************************
          End of file
 **********************************************************************/
index b37b6ab..273ce4e 100644 (file)
@@ -36,6 +36,14 @@ DuMacStopInd packMacStopIndOpts[] =
    packMacStopInd
 };
 
+/* Funtion pointer options for UL CCCH indication */
+DuMacUlCcchInd packMacUlCcchIndOpts[] =
+{
+   packMacUlCcchInd,
+   duHandleUlCcchInd,
+   packMacUlCcchInd
+};
+
 /*******************************************************************
  *
  * @brief Send slot indication to MAC
@@ -80,6 +88,30 @@ uint16_t MacDuAppStopInd(Pst *pst, MacCellStopInfo *cellStopId)
    return (*packMacStopIndOpts[pst->selector])(pst, cellStopId);
 }
 
+/*******************************************************************
+ *
+ * @brief Send UL CCCH Ind to DU APP
+ *
+ * @details
+ *
+ *    Function :MacDuAppUlCcchInd 
+ *
+ *    Functionality:
+ *       Select appropriate function using selector value and
+ *       send to DU APP
+ *
+ * @params[in]  Post structure pointer
+ *              UlCcchInd pointer 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t MacDuAppUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
+{
+   return (*packMacUlCcchIndOpts[pst->selector])(pst, ulCcchIndInfo);
+}
+
+
 /**********************************************************************
          End of file
 **********************************************************************/
index 75a3963..9eb5333 100644 (file)
@@ -47,6 +47,7 @@
 
 uint16_t MacDuAppSlotInd(Pst *pst, SlotInfo *slotInfo);
 uint16_t MacDuAppStopInd(Pst *pst, MacCellStopInfo *cellStopId);
+uint16_t MacDuAppUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
 /**********************************************************************
          End of file
 **********************************************************************/
index e6a65c4..335a367 100755 (executable)
@@ -137,10 +137,14 @@ Buffer  *mBuf;                      /* message buffer       */
          /* Process MAC cell start request */
          unpackMacCellStartReq(MacHdlCellStartReq, pst, mBuf);
          break;
-      case EVENT_MAC_CELL_STOP_REQ:
-         /* Process MAC cell stop request */
-         unpackMacCellStopReq(MacHdlCellStopReq, pst, mBuf);
-         break;
+               case EVENT_MAC_CELL_STOP_REQ:
+                       /* Process MAC cell stop request */
+                       unpackMacCellStopReq(MacHdlCellStopReq, pst, mBuf);
+                       break;
+               case EVENT_MAC_DL_CCCH_IND:
+                       /* Process DL CCCH Ind */
+                       unpackMacDlCcchInd(MacHdlDlCcchInd, pst, mBuf);
+                       break;
       default:
          RG_FREE_MSG(mBuf);
          break;
index 615e3e5..e96308a 100755 (executable)
@@ -98,7 +98,7 @@ EXTERN Void rgGetSId ARGS((SystemId *s));
 
 /* Public variable declaration */
 ClCb   clGlobalCp;
-MacCb  macCb;
+extern MacCb  macCb;
 
 int MacSchCellCfgReq(Pst *pst,MacCellCfg *macCellCfg);
 
index 2af744d..3ade194 100644 (file)
@@ -219,6 +219,8 @@ int unpackMacCellCfgCfm(
  * ****************************************************************/
 uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
 {
+       Buffer *mBuf = NULLP;
+
    if(pst->selector == DU_SELECTOR_LC)
    {
       /* Loose coupling not supported */
@@ -226,7 +228,6 @@ uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
    }
    else if(pst->selector == DU_SELECTOR_LWLC)
    {
-      Buffer *mBuf = NULLP;
 
       if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
       {
@@ -237,9 +238,8 @@ uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo)
       /* pack the address of the structure */
       CMCHKPK(cmPkPtr,(PTR)cellStartInfo, mBuf);
 
-      return SPstTsk(pst,mBuf);
    }
-   return ROK;
+       return SPstTsk(pst,mBuf);
 }
 
 /*******************************************************************
@@ -549,6 +549,167 @@ uint16_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf)
    }
    return ROK;
 }
+
+/*******************************************************************
+ *
+ * @brief Packs and Sends UL CCCH Ind from MAC to DUAPP
+ *
+ * @details
+ *
+ *    Function : packMacUlCcchInd
+ *
+ *    Functionality:
+ *       Packs and Sends UL CCCH Ind from MAC to DUAPP
+ *
+ * @params[in] Post structure pointer
+ *             UL CCCH Ind pointer              
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
+{
+   Buffer *mBuf = NULLP;
+       if(pst->selector == DU_SELECTOR_LWLC)
+       {
+               if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
+               {
+                       DU_LOG("\nMAC : Memory allocation failed at packMacUlCcchInd");
+                       return RFAILED;
+               }
+               /* pack the address of the structure */
+               CMCHKPK(cmPkPtr,(PTR)ulCcchIndInfo, mBuf);
+       }
+       else
+       {
+               DU_LOG("\nMAC: Only LWLC supported for UL CCCH Ind ");
+               return RFAILED;
+       }
+
+       return SPstTsk(pst,mBuf);
+}
+
+/*******************************************************************
+ *
+ * @brief Unpacks UL CCCH indication from MAC
+ *
+ * @details
+ *
+ *    Function : unpackMacUlCcchInd
+ *
+ *    Functionality:
+ *         Unpacks UL CCCH indication from MAC
+ *
+ * @params[in] Pointer to Handler
+ *             Post structure pointer
+ *             Message Buffer
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf)
+{
+   if(pst->selector == DU_SELECTOR_LWLC)
+   {
+      UlCcchIndInfo *ulCcchIndInfo;
+
+      /* unpack the address of the structure */
+               CMCHKUNPK(cmUnpkPtr, (PTR *)&ulCcchIndInfo, mBuf);
+               SPutMsg(mBuf);
+               return (*func)(pst, ulCcchIndInfo);
+       }
+       else
+       {
+               /* Nothing to do for other selectors */
+               DU_LOG("\n Only LWLC supported for UL CCCH Ind ");
+               SPutMsg(mBuf);
+       }
+       return RFAILED;
+}
+
+/*******************************************************************
+ *
+ * @brief Packs and Sends DL CCCH Ind from DUAPP to MAC
+ *
+ * @details
+ *
+ *    Function : packMacDlCcchInd
+ *
+ *    Functionality:
+ *       Packs and Sends DL CCCH Ind from DUAPP to MAC
+ *
+ *
+ * @params[in] Post structure pointer
+ *             DL CCCH Ind pointer              
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo)
+{
+       Buffer *mBuf = NULLP;
+
+       if(pst->selector == DU_SELECTOR_LWLC)
+       {
+               if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK)
+               {
+                       DU_LOG("\nMAC : Memory allocation failed at packMacDlCcchInd");
+                       return RFAILED;
+               }
+               /* pack the address of the structure */
+               CMCHKPK(cmPkPtr,(PTR)dlCcchIndInfo, mBuf);
+       }
+       else
+       {
+               DU_LOG("\nDU APP: Only LWLC supported for DL CCCH Ind ");
+               return RFAILED;
+       }
+
+       return SPstTsk(pst,mBuf);
+}
+
+/*******************************************************************
+ *
+ * @brief Unpacks DL CCCH indication from DU APP
+ *
+ * @details
+ *
+ *    Function : unpackMacDlCcchInd
+ *
+ *    Functionality:
+ *         Unpacks DL CCCH indication from DU APP
+ *
+ * @params[in] Pointer to Handler
+ *             Post structure pointer
+ *             Message Buffer
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf)
+{
+       if(pst->selector == DU_SELECTOR_LWLC)
+       {
+               DlCcchIndInfo *dlCcchIndInfo;
+
+               /* unpack the address of the structure */
+               CMCHKUNPK(cmUnpkPtr, (PTR *)&dlCcchIndInfo, mBuf);
+               SPutMsg(mBuf);
+               return (*func)(pst, dlCcchIndInfo);
+       }
+       else
+       {
+               /* Nothing to do for other selectors */
+               DU_LOG("\n Only LWLC supported for DL CCCH Ind ");
+               SPutMsg(mBuf);
+       }
+
+       return RFAILED;
+}
+
+
+
 /**********************************************************************
          End of file
 **********************************************************************/
index a636145..3b1c558 100644 (file)
@@ -47,6 +47,8 @@
 #define EVENT_MAC_CELL_STOP_REQ      203
 #define EVENT_MAC_SLOT_IND           204
 #define EVENT_MAC_STOP_IND           205
+#define EVENT_MAC_UL_CCCH_IND        206
+#define EVENT_MAC_DL_CCCH_IND        207
 
 typedef enum
 {
@@ -116,6 +118,12 @@ typedef enum
    SSB_PRDCTY_MS_160
 }SSBPeriod;
 
+typedef enum
+{
+   RRC_REJECT,
+   RRC_SETUP
+}DlCcchMsgType;
+
 typedef struct carrierCfg
 {
    Bool  pres;
@@ -295,42 +303,42 @@ typedef struct macCellStopInfo
    uint16_t cellId;
 }MacCellStopInfo;
 
+typedef struct ulCcchInd
+{
+   uint16_t cellId;
+   uint16_t crnti;
+   uint8_t  *ulCcchMsg;
+}UlCcchIndInfo;
+
+typedef struct dlCcchInd
+{
+   uint16_t      cellId;
+   uint16_t      crnti;
+   DlCcchMsgType msgType;
+   uint8_t       *dlCcchMsg;
+}DlCcchIndInfo;
+
+
 /* Functions for slot Ind from MAC to DU APP*/
 typedef uint16_t (*DuMacSlotInd) ARGS((
    Pst       *pst,
    SlotInfo  *slotInfo ));
 
-extern uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo );
-extern uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf);
-extern uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo);
-
 /* Functions for stop Ind from MAC to DU APP*/
 typedef uint16_t (*DuMacStopInd) ARGS((
    Pst       *pst,
    MacCellStopInfo  *cellId ));
 
-extern uint16_t packMacStopInd(Pst *pst, MacCellStopInfo *cellId);
-extern uint16_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf);
-extern uint16_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellId);
-
 /* Functions for mac cell start req */
 typedef uint16_t (*DuMacCellStartReq) ARGS((
    Pst               *pst, 
    MacCellStartInfo  *cellStartInfo ));
 
-extern uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo);
-extern uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf);
-extern uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo);
-
 /* Functions for mac cell stop request */
 typedef uint16_t (*DuMacCellStopReq) ARGS((
    Pst               *pst,
    MacCellStopInfo  *cellStopInfo ));
  
-extern uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo);
-extern uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf);
-extern uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo);
-
 /* Function pointers for packing macCellCfg Request and Confirm */
 typedef int (*packMacCellCfgReq) ARGS((
    Pst           *pst,
@@ -348,11 +356,39 @@ typedef int (*DuMacCellCfgCfm) ARGS((
    Pst        *pst,        
    MacCellCfgCfm *macCellCfgCfm ));
 
+/* Functions for UL CCCH Ind from MAC to DU APP*/
+typedef uint16_t (*DuMacUlCcchInd) ARGS((
+   Pst           *pst,
+   UlCcchIndInfo *ulCcchIndInfo ));
+
+/* Functions for DL CCCH Ind from DU APP to MAC*/
+typedef uint16_t (*DuMacDlCcchInd) ARGS((
+   Pst           *pst,
+   DlCcchIndInfo *dlCcchIndInfo ));
+
+extern uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo );
+extern uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf);
+extern uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo);
+extern uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo);
+extern uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf);
+extern uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo  *cellStartInfo);
+extern uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo);
+extern uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf);
+extern uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo  *cellStopInfo);
 extern int  packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
 extern int MacHdlCellCfgReq(Pst *pst, MacCellCfg *macCellCfg);
 extern void cmUnpackLwLcMacCellCfg(DuMacCellCfgReq func, Pst *pst, Buffer *mBuf);
 extern int unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf);
 extern int duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
+extern uint16_t packMacStopInd(Pst *pst, MacCellStopInfo *cellId);
+extern uint16_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf);
+extern uint16_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellId);
+extern uint16_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
+extern uint16_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf);
+extern uint16_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
+extern uint16_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
+extern uint16_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf);
+extern uint16_t MacHdlDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
 uint8_t sendStopIndMacToDuApp();
 #endif
 
index 522801e..73732df 100644 (file)
@@ -171,6 +171,37 @@ S16 procF1SetupRsp(F1AP_PDU_t *f1apMsg)
    return ret;
 }
 
+/*******************************************************************
+ *
+ * @brief Processes GNB DU config update ack
+ *
+ * @details
+ *
+ *    Function : procGNBDUCfgUpdAck
+ *
+ *    Functionality: Processes GNB DU config update ack
+ *
+ * @params[in] F1AP_PDU_t ASN decoded F1AP message
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+S16 procGNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
+{
+   DU_LOG("\nF1AP : GNB-DU config update acknowledgment received");
+/* TODO :Check the deallocation */
+#if 0
+   SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data*)&(gNBDuCfgAck->protocolIEs.list.array),\
+           (Size)elementCnt * sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t
+));
+   SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data*)&(f1apMsg->choice.successfulOutcome),\
+           (Size)sizeof(SuccessfulOutcome_t));
+   SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data*)&f1apMsg,(Size)sizeof(F1AP_PDU_t));
+#endif
+    return ROK;
+}
+
+
 /**********************************************************************
   End of file
  **********************************************************************/
index 277c69a..e051654 100644 (file)
 #define CU_DU_NAME_LEN_MAX 30      /* Max length of CU/DU name string */
 #define MAX_F1_CONNECTIONS 65536    /* Max num of F1 connections */
 #define DU_MAX_CELLS       1      /* Max num of cells served by gNB-DU */
+#define DU_MAX_UE          1      /* Maximum number of UE Ids */
 #define MAX_PLMN           6        /* Max num of broadcast PLMN ids */
 #define MAXNRARFCN         3279165  /* Maximum values of NRAFCN */
 #define MAXNRCELLBANDS     2       /* Maximum number of frequency bands */
 #define MAX_NUM_OF_SLICE_ITEMS 1024     /* Maximum number of signalled slice support items */
 #define MAXBPLMNNRMINUS1   1       /* Maximum number of PLMN Ids broadcast in an NR cell minus 1 */
 #define MAXNUMOFSIBTYPES   32       /* Maximum number of SIB types */
-#define MAX_UEID           512      /* Maximum number of UE Ids */
 #define MAX_TNL_ASSOC      32       /* Max num of TNL Assoc between CU and DU */
 #define MAXCELLINENB       256      /* Max num of cells served by eNB */
 #define MAX_NUM_OF_UE_ID       65536    /* Max num of UEs served by DU */
 #define DU_RANAC 1
 #define CELL_IDENTITY 32
 
+/* Macro definitions for DUtoCuRrcContainer */
+#define CELL_GRP_ID 1
+#define SCH_REQ_ID  0
+#define SR_PROHIBIT_TMR 5
+#define SR_TRANS_MAX 2
+#define PERIODIC_BSR_TMR 2
+#define RETX_BSR_TMR     5
+#define TAG_ID 0
+#define TIME_ALIGNMENT_TMR 7
+#define PHR_PERIODIC_TMR 7
+#define PHR_PROHIBHIT_TMR 0
+#define PHR_PWR_FACTOR_CHANGE 3
+#define PHR_MODE_OTHER_CG 0
+#define RLC_LCID 1 
+#define SRB_ID_1 1
+#define SN_FIELD_LEN 0
+#define T_POLL_RETRANSMIT 8 
+#define POLL_PDU 0
+#define POLL_BYTE 43
+#define MAX_RETX_THRESHOLD 5
+#define T_REASSEMBLY 8
+#define T_STATUS_PROHIBHIT 7
+#define MAC_LC_PRIORITY 1
+#define PRIORTISIED_BIT_RATE 15
+#define BUCKET_SIZE_DURATION 5
+#define LC_GRP 0
+#define P_NR_FR1 0
+#define PDSCH_HARQ_ACK_CODEBOOK 1
+#define SERV_CELL_IDX 0
+#define RLM_SYNC_OUT_SYNC_THRESHOLD 0
+#define ACTIVE_DL_BWP_ID 0
+
 #ifdef EGTP_TEST
 #define UE_ID 1
 #define RB_ID 1
@@ -794,7 +826,7 @@ typedef struct f1GnbDuCfgUpd
   F1DuSrvdCellToDel   srvdCellLstMod[DU_MAX_CELLS];      /* Served cell list to be modified */
   NrEcgi              srvdCellLstDel[DU_MAX_CELLS];      /* Served cell list to be deleted */
   F1CellStatus        cellStatus[DU_MAX_CELLS];          /* Cell status */
-  F1DedSIDelUE        ueLst[MAX_UEID];                     /* Ue list that requires dedicated SI delivery */
+  F1DedSIDelUE        ueLst[DU_MAX_UE];                     /* Ue list that requires dedicated SI delivery */
   uint32_t            gnbDuId;
   F1TnlAssocToRmv     gnbDuTnlAssocRmv[MAX_TNL_ASSOC];  /* TNL Assoc list to remove */ 
 }F1GnbDuCfgUpd;
index 381ddca..791a128 100644 (file)
 #include "du_cell_mgr.h"
 #include "du_f1ap_msg_hdl.h"
 #include "GNB-DU-System-Information.h"
-static S16 BuildULTnlInforet=RFAILED;
+#include "CellGroupConfigRrc.h"
+#include "MAC-CellGroupConfig.h"
+#include "SchedulingRequestConfig.h"
+#include "SchedulingRequestToAddMod.h"
+#include "BSR-Config.h"
+#include "TAG-Config.h"
+#include "TAG.h"
+#include "PHR-Config.h"
+#include "RLC-Config.h"
+#include "UL-AM-RLC.h"
+#include "DL-AM-RLC.h"
+#include "LogicalChannelConfig.h"
+#include "RLC-BearerConfig.h"
+#include "PhysicalCellGroupConfig.h"
+#include "SpCellConfig.h"
+#include "ServingCellConfig.h"
+#include "BWP-DownlinkDedicated.h"
+#include "UplinkConfig.h"
+#include "DUtoCURRCContainer.h"
+
 extern char encBuf[ENC_BUF_MAX_LEN];
 extern DuCfgParams duCfgParam;
+static S16 BuildULTnlInforet=RFAILED;
+
 S16 sctpSend(Buffer *mBuf, U8 itfType);
+
+
 /*******************************************************************
  *
  * @brief Builds Uplink Info for NR 
@@ -1969,247 +1992,1262 @@ S16 BuildAndSendULRRCMessageTransfer()
 }/* End of BuildAndSendULRRCMessageTransfer*/
 
 /*******************************************************************
- *
- * @brief Builds and sends the InitialULRRCMessage 
- *
- * @details
- *
- *    Function : BuildAndSendRRCSetupReq
- *
- *    Functionality: Constructs the Initial UL RRC Message Transfer and sends
- *                   it to the CU through SCTP.
- *
- * @params[in] 
- *
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-S16 BuildAndSendRRCSetupReq()
+*
+* @brief Builds tag config 
+*
+* @details
+*
+*    Function : BuildTagConfig 
+*
+*    Functionality: Builds tag config in MacCellGroupConfig
+*
+* @params[in] TAG_Config *tag_Config
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildTagConfig(struct TAG_Config *tagConfig)
 {
-   S16  ret;
-       U8   elementCnt;
-   U8   ieId;
-       U8   idx;
-       U8   idx1;
-       F1AP_PDU_t  *f1apMsg = NULLP;
-       InitialULRRCMessageTransfer_t *initULRRCMsg=NULLP;
-   asn_enc_rval_t                encRetVal;
-       bool  checkvar=false;
-       while(1)
-       {
-            DU_LOG("\n F1AP : Building RRC Setup Request\n");
-                 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
-                 if(f1apMsg == NULLP)
-                 {
-                     DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
-                          break;
-                 }
-                 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
-                 DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
-                 if(f1apMsg->choice.initiatingMessage == NULLP)
-                 {
-                    DU_LOG(" F1AP : Memory allocation for  F1AP-PDU failed");
-                         break;
-                 }
-                 f1apMsg->choice.initiatingMessage->procedureCode =\
-                        ProcedureCode_id_InitialULRRCMessageTransfer;
-                 f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
-                 f1apMsg->choice.initiatingMessage->value.present = \
-                        InitiatingMessage__value_PR_InitialULRRCMessageTransfer;
-                 initULRRCMsg =\
-                        &f1apMsg->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer;
-        elementCnt = 3;
-                 initULRRCMsg->protocolIEs.list.count = elementCnt;
-                 initULRRCMsg->protocolIEs.list.size = \
-                        elementCnt * sizeof(InitialULRRCMessageTransferIEs_t *);
-                 /* Initialize the F1Setup members */
-                  DU_ALLOC(initULRRCMsg->protocolIEs.list.array,initULRRCMsg->protocolIEs.list.size);
-                  if(initULRRCMsg->protocolIEs.list.array == NULLP)
-                  {
-                     DU_LOG(" F1AP : Memory allocation for\
-                               RRCSetupRequestMessageTransferIEs failed");
-                               break;
-                  }
-                  for(idx=0; idx<elementCnt; idx++)
-             {
-                          DU_ALLOC(initULRRCMsg->protocolIEs.list.array[idx],\
-                                sizeof(InitialULRRCMessageTransferIEs_t));
-                                if(initULRRCMsg->protocolIEs.list.array[idx] == NULLP)
-                                {
-                                    break;
-                                }
-                  }
-                  idx1 = 0;
-                  /*GNB DU UE F1AP ID*/
-                  initULRRCMsg->protocolIEs.list.array[idx1]->id  = \
-                                     ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
-                       initULRRCMsg->protocolIEs.list.array[idx1]->criticality  = Criticality_reject;
-                  initULRRCMsg->protocolIEs.list.array[idx1]->value.present = \
-                                     InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
-                  initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.GNB_DU_UE_F1AP_ID= DU_ID;
-                       /*NRCGI*/
-                       idx1++;
-                       initULRRCMsg->protocolIEs.list.array[idx1]->id  = \
-                                ProtocolIE_ID_id_NRCGI;
-                       initULRRCMsg->protocolIEs.list.array[idx1]->criticality  =Criticality_reject;
-                       initULRRCMsg->protocolIEs.list.array[idx1]->value.present = \
-                       InitialULRRCMessageTransferIEs__value_PR_NRCGI;
-                  
-                       ret =\
-                       BuildNrcgi(&initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.NRCGI);
-             if(ret!=ROK)
-                       {
-                           break;
-                       }
-                       initULRRCMsg->protocolIEs.list.array[idx1]->id  = \
-                                      ProtocolIE_ID_id_C_RNTI;
-                       initULRRCMsg->protocolIEs.list.array[idx1]->criticality  =Criticality_reject;
-                       initULRRCMsg->protocolIEs.list.array[idx1]->value.present =\
-                                InitialULRRCMessageTransferIEs__value_PR_C_RNTI;
-                       initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.C_RNTI =CRNTI;
-         /*RRCContainer*/
-                       // Need to fill this.
+       struct TAG_Config__tag_ToAddModList *tagList;
+   uint8_t                     idx, elementCnt;
 
-                       /*DUtoCURRCContainer*/
-                       //Need to fill this too.
-                       xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
-                       /* Encode the F1SetupRequest type as APER */
-                       cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN);
-                       encBufSize = 0;
-                       encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg,\
-                       PrepFinalEncBuf,encBuf);
-                       /* Encode results */
-                       if(encRetVal.encoded == ENCODE_FAIL)
-                       {
-                           DU_LOG( "\n F1AP : Could not encode Initial UL RRC Message Transfer\
-                                structure (at %s)\n",encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
-                                break;
-                       }
-                       else
-                       {
-                           
-                                 DU_LOG("\n F1AP : Created APER encoded buffer for Initial UL RRC\
-                                 Message transfer\n");
-                                  for(int i=0; i< encBufSize; i++)
-                                       {
-                                           printf("%x",encBuf[i]);
-                                       }
-                       }
-                       /* Sending  msg  */
-                       if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK)
-                       {
-                           DU_LOG("\n F1AP : Sending Initial UL RRC Message Transfer Failed");
-                                break;
-                       }
-                       checkvar=true;
-                       break;
-       }
-   
-       if(f1apMsg != NULLP)
-   {
-           if(f1apMsg->choice.initiatingMessage != NULLP)
-                {
-                    if(initULRRCMsg->protocolIEs.list.array != NULLP)
-                         {
-                        if(idx == elementCnt)
-                             {
-                                      idx1=1;
-                                 if(initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.NRCGI.pLMN_Identity.buf!=NULLP)
-                                      {
-                                          if(initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.NRCGI.nRCellIdentity.buf!=NULLP)
-                                               {
-                                                   DU_FREE(initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.NRCGI.nRCellIdentity.buf,
-                                                        initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.NRCGI.nRCellIdentity.size);
-                                               }
-                                               DU_FREE(initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.NRCGI.pLMN_Identity.buf,\
-                                                initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.NRCGI.pLMN_Identity.size);
-                                       }
-                                       for(ieId=0; ieId<elementCnt; ieId++)
-                                       {
-                                          DU_FREE(initULRRCMsg->protocolIEs.list.array[ieId],sizeof(InitialULRRCMessageTransferIEs_t));
-                                       }
-                              }
-                              else
-                              {
-                                   for(ieId=0; ieId<idx; ieId++)
-                                             {
-                                                 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieId],sizeof(InitialULRRCMessageTransferIEs_t));
-                                             }
-                               }
-                            DU_FREE(initULRRCMsg->protocolIEs.list.array,initULRRCMsg->protocolIEs.list.size);
-                        }
-                        DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
-                }
-                DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
+   tagConfig->tag_ToAddModList = NULLP;
+   DU_ALLOC(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
+       if(!tagConfig->tag_ToAddModList)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildTagConfig");
+               return RFAILED;
        }
-       if(checkvar==true)
-          return ROK;
-       else
-          return RFAILED;
-}/* End of BuildAndSendRRCSetupReq*/
 
-/*******************************************************************
- *
- * @brief Builds Special cell list for UE Setup Request 
- *
- * @details
- *
- *    Function : BuildSplCellList
- *
- *    Functionality: Constructs the Special Cell list for UESetReq
- *
- * @params[in] SCell_ToBeSetup_List_t *spCellLst
- *
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-S16 BuildSplCellList(SCell_ToBeSetup_List_t *spCellLst)
-{
-       U8  cellCnt;
-       U8  idx;
-       S16 ret;
-       cellCnt = 1;
-       spCellLst->list.count = cellCnt;
-       spCellLst->list.size = cellCnt * sizeof(SCell_ToBeSetup_ItemIEs_t *);
-       DU_ALLOC(spCellLst->list.array,spCellLst->list.size);
-       if(spCellLst->list.array == NULLP)
+       elementCnt = 1; //ODU_VALUE_ONE;
+       tagList = tagConfig->tag_ToAddModList;
+       tagList->list.count = elementCnt;
+       tagList->list.size  =  elementCnt * sizeof(struct TAG);
+
+   tagList->list.array = NULLP;
+       DU_ALLOC(tagList->list.array, tagList->list.size);
+       if(!tagList->list.array)
        {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildTagConfig");
                return RFAILED;
        }
-       for(idx=0; idx<cellCnt; idx++)
+
+       for(idx=0; idx<tagList->list.count; idx++)
        {
-               DU_ALLOC(spCellLst->list.array[idx],sizeof(SCell_ToBeSetup_ItemIEs_t));
-               if(spCellLst->list.array[idx] == NULLP)
+          tagList->list.array[idx] = NULLP;
+               DU_ALLOC(tagList->list.array[idx], sizeof(struct TAG));
+               if(!tagList->list.array[idx])
                {
+                       DU_LOG("\nF1AP : Memory allocation failure in BuildTagConfig");
                        return RFAILED;
                }
        }
+
        idx = 0;
-       spCellLst->list.array[idx]->id = ProtocolIE_ID_id_SCell_ToBeSetup_Item;
-       spCellLst->list.array[idx]->criticality = Criticality_ignore;
-       spCellLst->list.array[idx]->value.present =\
-               SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item;
-       /* Special Cell ID -NRCGI */
-       ret = BuildNrcgi(&spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCell_ID);
-       if(ret != ROK)
+       tagList->list.array[idx]->tag_Id = TAG_ID;
+       tagList->list.array[idx]->timeAlignmentTimer = TIME_ALIGNMENT_TMR;
+
+   return ROK;
+}
+
+/*******************************************************************
+*
+* @brief Builds PHR Config 
+*
+* @details
+*
+*    Function : BuildPhrConfig
+*
+*    Functionality: Builds phrConfig in MacCellGroupConfig
+*
+* @params[in] PHR Config *
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildPhrConfig(struct MAC_CellGroupConfig__phr_Config *phrConfig)
+{
+
+   phrConfig->present = MAC_CellGroupConfig__phr_Config_PR_setup;
+       phrConfig->choice.setup = NULLP;
+       DU_ALLOC(phrConfig->choice.setup, sizeof(struct PHR_Config));
+       if(!phrConfig->choice.setup)
        {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildPhrConfig");
                return RFAILED;
        }
-       /*Special Cell Index*/
-       spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCellIndex = 1;
-  return ROK;  
-}/* End of BuildSplCellList*/
+
+       phrConfig->choice.setup->phr_PeriodicTimer        = PHR_PERIODIC_TMR;
+       phrConfig->choice.setup->phr_ProhibitTimer        = PHR_PROHIBHIT_TMR;
+   phrConfig->choice.setup->phr_Tx_PowerFactorChange = PHR_PWR_FACTOR_CHANGE;
+       phrConfig->choice.setup->multiplePHR              = false;
+       phrConfig->choice.setup->dummy                    = false;
+       phrConfig->choice.setup->phr_Type2OtherCell       = false;
+       phrConfig->choice.setup->phr_ModeOtherCG          = PHR_MODE_OTHER_CG;
+
+       return ROK;
+}
 
 /*******************************************************************
- *
- * @brief Builds SRBS to be setup 
- *
- * @details
- *
- *    Function : BuildSRBSetup
- *
+*
+* @brief Builds BSR Config 
+*
+* @details
+*
+*    Function : BuildBsrConfig
+*
+*    Functionality: Builds BuildBsrConfig in MacCellGroupConfig
+*
+* @params[in] BSR_Config *bsrConfig
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildBsrConfig(struct BSR_Config *bsrConfig)
+{
+   bsrConfig->periodicBSR_Timer = PERIODIC_BSR_TMR;
+       bsrConfig->retxBSR_Timer     = RETX_BSR_TMR;
+
+   return ROK;
+}
+
+/*******************************************************************
+*
+* @brief Builds scheduling request config 
+*
+* @details
+*
+*    Function : BuildSchedulingReqConfig 
+*
+*    Functionality: Builds BuildSchedulingReqConfig in MacCellGroupConfig
+*
+* @params[in] SchedulingRequestConfig *schedulingRequestConfig
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildSchedulingReqConfig(struct SchedulingRequestConfig *schedulingRequestConfig)
+{
+       struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList;
+   uint8_t                     idx, elementCnt;
+
+   schedulingRequestConfig->schedulingRequestToAddModList = NULLP;
+       DU_ALLOC(schedulingRequestConfig->schedulingRequestToAddModList,
+                       sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList));
+       if(!schedulingRequestConfig->schedulingRequestToAddModList)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildSchedulingReqConfig");
+               return RFAILED;
+       }
+
+       elementCnt = 1; //ODU_VALUE_ONE;
+       schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
+       schReqList->list.count = elementCnt;
+       schReqList->list.size  =  elementCnt * sizeof(SchedulingRequestId_t);
+
+   schReqList->list.array = NULLP;
+   DU_ALLOC(schReqList->list.array, schReqList->list.size);
+       if(!schReqList->list.array)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildSchedulingReqConfig");
+               return RFAILED;
+       }
+
+   for(idx=0;idx<schReqList->list.count; idx++)
+       {
+          schReqList->list.array[idx] = NULLP;
+      DU_ALLOC(schReqList->list.array[idx], sizeof(SchedulingRequestId_t));
+               if(!schReqList->list.array[idx])
+               {
+                       DU_LOG("\nF1AP : Memory allocation failure in BuildSchedulingReqConfig");
+                       return RFAILED;
+               }
+       }
+
+       idx = 0;
+       schReqList->list.array[idx]->schedulingRequestId = SCH_REQ_ID;
+
+   schReqList->list.array[idx]->sr_ProhibitTimer = NULLP;
+       DU_ALLOC(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
+       if(!schReqList->list.array[idx]->sr_ProhibitTimer)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildSchedulingReqConfig");
+               return RFAILED;
+       }
+   *(schReqList->list.array[idx]->sr_ProhibitTimer) = SR_PROHIBIT_TMR;
+
+       schReqList->list.array[idx]->sr_TransMax = SR_TRANS_MAX;
+
+       return ROK;
+}
+
+/*******************************************************************
+*
+* @brief Builds RLC Config
+*
+* @details
+*
+*    Function : BuildRlcConfig
+*
+*    Functionality: Builds RLC Config in BuildRlcBearerToAddModList 
+*
+* @params[in] RLC_Config *rlcConfig
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildRlcConfig(struct RLC_Config *rlcConfig)
+{
+
+   rlcConfig->present = RLC_Config_PR_am;
+
+   rlcConfig->choice.am = NULLP;
+   DU_ALLOC(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
+       if(!rlcConfig->choice.am)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildRlcConfig");
+               return RFAILED;
+       }
+
+   /* UL */
+       rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength = NULLP;
+   DU_ALLOC(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
+       if(!rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildRlcConfig");
+               return RFAILED;
+       }
+   *(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength) = SN_FIELD_LEN;
+       rlcConfig->choice.am->ul_AM_RLC.t_PollRetransmit  = T_POLL_RETRANSMIT;
+       rlcConfig->choice.am->ul_AM_RLC.pollPDU           = POLL_PDU;
+       rlcConfig->choice.am->ul_AM_RLC.pollByte          = POLL_BYTE;
+       rlcConfig->choice.am->ul_AM_RLC.maxRetxThreshold  = MAX_RETX_THRESHOLD;
+
+   /* DL */
+       rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength = NULLP;
+   DU_ALLOC(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t)); 
+       if(!rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildRlcConfig");
+               return RFAILED;
+       }
+       *(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength) = SN_FIELD_LEN;
+   rlcConfig->choice.am->dl_AM_RLC.t_Reassembly      = T_REASSEMBLY;
+       rlcConfig->choice.am->dl_AM_RLC.t_StatusProhibit  = T_STATUS_PROHIBHIT;
+
+   return ROK;
+}
+
+/*******************************************************************
+*
+* @brief Builds MAC LC Config
+*
+* @details
+*
+*    Function : BuildMacLCConfig 
+*
+*    Functionality: Builds MAC LC Config in BuildRlcBearerToAddModList 
+*
+* @params[in] struct LogicalChannelConfig macLcConfig
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildMacLCConfig(struct LogicalChannelConfig *macLcConfig)
+{
+
+   macLcConfig->ul_SpecificParameters = NULLP;
+   DU_ALLOC(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
+       if(!macLcConfig->ul_SpecificParameters)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildMacLCConfig");
+               return RFAILED;
+       }
+
+   macLcConfig->ul_SpecificParameters->priority = MAC_LC_PRIORITY;
+       macLcConfig->ul_SpecificParameters->prioritisedBitRate =        PRIORTISIED_BIT_RATE;
+       macLcConfig->ul_SpecificParameters->bucketSizeDuration =        BUCKET_SIZE_DURATION;
+
+   macLcConfig->ul_SpecificParameters->logicalChannelGroup = NULLP;
+   DU_ALLOC(macLcConfig->ul_SpecificParameters->logicalChannelGroup,   sizeof(long));
+   if(!macLcConfig->ul_SpecificParameters->logicalChannelGroup)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildMacLCConfig");
+               return RFAILED;
+       }
+   *(macLcConfig->ul_SpecificParameters->logicalChannelGroup) = LC_GRP;
+
+   macLcConfig->ul_SpecificParameters->schedulingRequestID = NULLP;
+       DU_ALLOC(macLcConfig->ul_SpecificParameters->schedulingRequestID,       sizeof(SchedulingRequestId_t));
+       if(!macLcConfig->ul_SpecificParameters->schedulingRequestID)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildMacLCConfig");
+               return RFAILED;
+       }
+   *(macLcConfig->ul_SpecificParameters->schedulingRequestID) = SCH_REQ_ID;
+
+       macLcConfig->ul_SpecificParameters->logicalChannelSR_Mask = false;
+       macLcConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = false;
+
+   return ROK;
+}
+
+/*******************************************************************
+*
+* @brief Builds RLC Bearer to Add/Mod list
+*
+* @details
+*
+*    Function :BuildRlcBearerToAddModList 
+*
+*    Functionality: Builds RLC Bearer to Add/Mod list in DuToCuRrcContainer
+*
+* @params[in] rlc_BearerToAddModList
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildRlcBearerToAddModList(struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList)
+{
+   uint8_t                     idx, elementCnt;
+
+   elementCnt = 1;
+   rlcBearerList->list.count = elementCnt;
+       rlcBearerList->list.size  = elementCnt * sizeof(struct RLC_BearerConfig);
+
+   rlcBearerList->list.array = NULLP;
+       DU_ALLOC(rlcBearerList->list.array, rlcBearerList->list.size);
+       if(!rlcBearerList->list.array)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+               return RFAILED;
+       }
+
+   for(idx=0; idx<rlcBearerList->list.count; idx++)
+       {
+          rlcBearerList->list.array[idx] = NULLP;
+               DU_ALLOC(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
+               if(!rlcBearerList->list.array[idx])
+               {
+                       DU_LOG("\nF1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+                       return RFAILED;
+               }
+       }
+
+   idx = 0;
+       rlcBearerList->list.array[idx]->logicalChannelIdentity = RLC_LCID;
+
+       DU_ALLOC(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
+       if(!rlcBearerList->list.array[idx]->servedRadioBearer)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+               return RFAILED;
+       }
+
+       rlcBearerList->list.array[idx]->servedRadioBearer->present = RLC_BearerConfig__servedRadioBearer_PR_srb_Identity;
+   rlcBearerList->list.array[idx]->servedRadioBearer->choice.srb_Identity = SRB_ID_1;
+
+   rlcBearerList->list.array[idx]->rlc_Config = NULLP;
+   DU_ALLOC(rlcBearerList->list.array[idx]->rlc_Config, sizeof(struct RLC_Config));
+       if(!rlcBearerList->list.array[idx]->rlc_Config)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+               return RFAILED;
+       }
+
+   if(BuildRlcConfig(rlcBearerList->list.array[idx]->rlc_Config) != ROK)
+       {
+               DU_LOG("\nF1AP : BuildRlcConfig failed");
+               return RFAILED;
+       }
+
+   rlcBearerList->list.array[idx]->mac_LogicalChannelConfig = NULLP;
+   DU_ALLOC(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
+       if(!rlcBearerList->list.array[idx]->mac_LogicalChannelConfig)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildRlcBearerToAddModList");
+               return RFAILED;
+       }
+
+       if(BuildMacLCConfig(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig) != ROK)
+       {
+               DU_LOG("\nF1AP : BuildMacLCConfig failed");
+               return RFAILED;
+       }
+
+       return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds intitial DL BWP
+ * @details
+ *
+ *    Function : BuildInitialDlBWP 
+ *
+ *    Functionality: Builds intitial DL BWP in spCellCfgDed
+ *
+ * @params[in] BWP_DownlinkDedicated_t *dlBwp
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildInitialDlBWP(BWP_DownlinkDedicated_t *dlBwp)
+{
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds UL config
+ * @details
+ *
+ *    Function : BuildUlCfg 
+ *
+ *    Functionality: Builds UL config in spCellCfgDed
+ *
+ * @params[in] UplinkConfig_t *ulCfg
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildUlCfg(UplinkConfig_t *ulCfg)
+{
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds PDSCH serving cell config
+ * @details
+ *
+ *    Function : BuildPdschSrvCellCfg
+ *
+ *    Functionality: Builds PDSCH serving cell config in spCellCfgDed
+ *
+ * @params[in] struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg 
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildPdschSrvCellCfg(struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg)
+{
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds CSI Meas config
+ * @details
+ *
+ *    Function : BuildCsiMeasCfg 
+ *
+ *    Functionality: Builds CSI Meas config in spCellCfgDed
+ *
+ * @params[in] struct ServingCellConfig__csi_MeasConfig *csiMeasCfg
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildCsiMeasCfg(struct ServingCellConfig__csi_MeasConfig *csiMeasCfg)
+{
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds Spcell config dedicated
+ * @details
+ *
+ *    Function : BuildSpCellCfgDed
+ *
+ *    Functionality: Builds sp cell config dedicated in spCellCfg
+ *
+ * @params[in] ServingCellConfig_t srvCellCfg
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildSpCellCfgDed(ServingCellConfig_t *srvCellCfg)
+{
+
+   srvCellCfg->initialDownlinkBWP = NULLP;
+   DU_ALLOC(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
+       if(!srvCellCfg->initialDownlinkBWP)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfgDed");
+               return RFAILED;
+       }
+
+   if(BuildInitialDlBWP(srvCellCfg->initialDownlinkBWP) != ROK)
+       {
+               DU_LOG("\nF1AP : BuildInitialDlBWP failed");
+               return RFAILED;
+       }
+
+   srvCellCfg->firstActiveDownlinkBWP_Id = NULLP;
+       DU_ALLOC(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
+       if(!srvCellCfg->firstActiveDownlinkBWP_Id)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfgDed");
+               return RFAILED;
+       }
+       *(srvCellCfg->firstActiveDownlinkBWP_Id) = ACTIVE_DL_BWP_ID;
+
+   srvCellCfg->defaultDownlinkBWP_Id = NULLP;
+       DU_ALLOC(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
+       if(!srvCellCfg->defaultDownlinkBWP_Id)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfgDed");
+               return RFAILED;
+       }
+       *(srvCellCfg->defaultDownlinkBWP_Id) = ACTIVE_DL_BWP_ID;
+
+   srvCellCfg->uplinkConfig = NULLP;
+   DU_ALLOC(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));
+       if(!srvCellCfg->uplinkConfig)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfgDed");
+               return RFAILED;
+       }
+
+   if(BuildUlCfg(srvCellCfg->uplinkConfig) != ROK)
+       {
+               DU_LOG("\nF1AP : BuildUlCfg failed");
+               return RFAILED;
+       }
+
+   srvCellCfg->pdsch_ServingCellConfig = NULLP;
+       DU_ALLOC(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct     ServingCellConfig__pdsch_ServingCellConfig));
+       if(!srvCellCfg->pdsch_ServingCellConfig)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfgDed");
+               return RFAILED;
+       }
+
+   if(BuildPdschSrvCellCfg(srvCellCfg->pdsch_ServingCellConfig) != ROK)
+       {
+               DU_LOG("\nF1AP : BuildPdschSrvCellCfg failed");
+               return RFAILED;
+       }
+
+   srvCellCfg->csi_MeasConfig = NULLP;
+       DU_ALLOC(srvCellCfg->csi_MeasConfig, sizeof(struct      ServingCellConfig__csi_MeasConfig))
+       if(!srvCellCfg->csi_MeasConfig)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfgDed");
+               return RFAILED;
+       }
+
+   if(BuildCsiMeasCfg(srvCellCfg->csi_MeasConfig) != ROK)
+       {
+               DU_LOG("\nF1AP : BuildCsiMeasCfg failed");
+               return RFAILED;
+       }
+
+       srvCellCfg->tag_Id = TAG_ID;
+
+       return ROK;
+}
+/*******************************************************************
+ *
+ * @brief Builds Spcell config 
+ *
+ * @details
+ *
+ *    Function : BuildSpCellCfg 
+ *
+ *    Functionality: Builds sp cell config in DuToCuRrcContainer
+ *
+ * @params[in] SpCellConfig_t spCellCfg
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildSpCellCfg(SpCellConfig_t *spCellCfg)
+{
+
+   spCellCfg->servCellIndex = NULLP;
+       DU_ALLOC(spCellCfg->servCellIndex, sizeof(long));
+       if(!spCellCfg->servCellIndex)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfg");
+               return RFAILED;
+       }
+   *(spCellCfg->servCellIndex) = SERV_CELL_IDX;
+
+   spCellCfg->rlmInSyncOutOfSyncThreshold = NULLP;
+       DU_ALLOC(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
+       if(!spCellCfg->rlmInSyncOutOfSyncThreshold)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfg");
+               return RFAILED;
+       }
+   *(spCellCfg->rlmInSyncOutOfSyncThreshold) = RLM_SYNC_OUT_SYNC_THRESHOLD;
+
+   spCellCfg->spCellConfigDedicated = NULLP;
+   DU_ALLOC(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
+       if(!spCellCfg->spCellConfigDedicated)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfg");
+               return RFAILED;
+       }
+
+   if(BuildSpCellCfgDed(spCellCfg->spCellConfigDedicated) != ROK)
+       {
+               DU_LOG("\nF1AP : BuildSpCellCfgDed failed");
+               return RFAILED;
+       }
+
+       return ROK;
+}
+/*******************************************************************
+*
+* @brief Builds Phy cell group config 
+*
+* @details
+*
+*    Function : BuildPhyCellGrpCfg 
+*
+*    Functionality: Builds Phy cell group config in DuToCuRrcContainer
+*
+* @params[in] PhysicalCellGroupConfig_t *phyCellGrpCfg 
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildPhyCellGrpCfg(PhysicalCellGroupConfig_t *phyCellGrpCfg)
+{
+   phyCellGrpCfg->p_NR_FR1 = NULLP;
+       DU_ALLOC(phyCellGrpCfg->p_NR_FR1, sizeof(long));
+       if(!phyCellGrpCfg->p_NR_FR1)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildPhyCellGrpCfg");
+               return RFAILED;
+       }
+   *(phyCellGrpCfg->p_NR_FR1)             = P_NR_FR1;
+       phyCellGrpCfg->pdsch_HARQ_ACK_Codebook = PDSCH_HARQ_ACK_CODEBOOK;
+
+       return ROK;
+}
+/*******************************************************************
+*
+* @brief Builds Mac cell group config 
+*
+* @details
+*
+*    Function : BuildMacCellGrpCfg 
+*
+*    Functionality: Builds Mac cell group config in DuToCuRrcContainer
+*
+* @params[in] MAC_CellGroupConfig_t *macCellGrpCfg
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildMacCellGrpCfg(MAC_CellGroupConfig_t *macCellGrpCfg)
+{
+
+   macCellGrpCfg->schedulingRequestConfig = NULLP;
+       DU_ALLOC(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
+       if(!macCellGrpCfg->schedulingRequestConfig)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildMacCellGrpCfg");
+               return RFAILED;
+       }
+
+       if(BuildSchedulingReqConfig(macCellGrpCfg->schedulingRequestConfig) != ROK)
+       {
+          DU_LOG("\nF1AP : BuildSchedulingReqConfig failed");
+               return RFAILED;
+       }
+
+   macCellGrpCfg->bsr_Config = NULLP;
+   DU_ALLOC(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
+       if(!macCellGrpCfg->bsr_Config)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildMacCellGrpCfg");
+               return RFAILED;
+       }
+
+   if(BuildBsrConfig(macCellGrpCfg->bsr_Config) != ROK)
+       {
+      DU_LOG("\nF1AP : BuildBsrConfig failed");
+          return RFAILED;
+       }
+
+   macCellGrpCfg->tag_Config = NULLP;
+   DU_ALLOC(macCellGrpCfg->tag_Config, sizeof(struct TAG_Config));
+       if(!macCellGrpCfg->tag_Config)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildMacCellGrpCfg");
+               return RFAILED;
+       }
+
+   if(BuildTagConfig(macCellGrpCfg->tag_Config) != ROK)
+       {
+          DU_LOG("\nF1AP : BuildTagConfig failed");
+          return RFAILED;
+   }
+
+   macCellGrpCfg->phr_Config = NULLP;
+   DU_ALLOC(macCellGrpCfg->phr_Config, sizeof(struct MAC_CellGroupConfig__phr_Config));
+       if(!macCellGrpCfg->phr_Config)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildMacCellGrpCfg");
+               return RFAILED;
+       }
+
+   if(BuildPhrConfig(macCellGrpCfg->phr_Config) != ROK)
+       {
+          DU_LOG("\nF1AP : BuildPhrConfig failed");
+          return RFAILED;
+   }
+
+   macCellGrpCfg->skipUplinkTxDynamic = false;
+
+       return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Frees emmory allocated for DUToCURRCContainer 
+ *
+ * @details
+ *
+ *    Function : FreeMemDuToCuRrcCont
+ *
+ *    Functionality: Builds DuToCuRrcContainer
+ *
+ * @params[in] DuToCuRRCContainer, DuToCuRRCContainer
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+* ****************************************************************/
+uint8_t FreeMemDuToCuRrcCont(CellGroupConfigRrc_t *cellGrpCfg)
+{
+   uint8_t idx;
+       struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList;
+       struct RLC_Config *rlcConfig;
+       struct LogicalChannelConfig *macLcConfig;
+       MAC_CellGroupConfig_t *macCellGrpCfg;
+       struct SchedulingRequestConfig *schedulingRequestConfig;
+       struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList;
+       struct TAG_Config *tagConfig;
+       struct TAG_Config__tag_ToAddModList *tagList;
+       struct MAC_CellGroupConfig__phr_Config *phrConfig;
+       PhysicalCellGroupConfig_t *phyCellGrpCfg;
+       SpCellConfig_t *spCellCfg;
+       ServingCellConfig_t *srvCellCfg;
+
+       rlcBearerList = cellGrpCfg->rlc_BearerToAddModList;
+       if(rlcBearerList)
+       {
+               if(rlcBearerList->list.array)
+               {
+                       for(idx=0; idx<rlcBearerList->list.count; idx++)
+                       {
+                               rlcConfig   = rlcBearerList->list.array[idx]->rlc_Config;
+                               macLcConfig = rlcBearerList->list.array[idx]->mac_LogicalChannelConfig;
+                               DU_FREE(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
+                               DU_FREE(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t)); 
+                               DU_FREE(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
+                               DU_FREE(rlcConfig, sizeof(struct RLC_Config));
+                               DU_FREE(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
+                               DU_FREE(macLcConfig->ul_SpecificParameters->schedulingRequestID,        sizeof(SchedulingRequestId_t));
+                               DU_FREE(macLcConfig->ul_SpecificParameters->logicalChannelGroup,        sizeof(long));
+                               DU_FREE(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
+                               DU_FREE(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
+                               DU_FREE(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
+                       }
+                       DU_FREE(rlcBearerList->list.array, rlcBearerList->list.size);
+               }
+               DU_FREE(cellGrpCfg->rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
+       }
+
+       macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig;
+       if(macCellGrpCfg)
+       {
+               schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig; 
+               schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
+
+               for(idx=0;idx<schReqList->list.count; idx++)
+               {
+                       DU_FREE(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
+                       DU_FREE(schReqList->list.array[idx], sizeof(SchedulingRequestId_t));
+               }
+               DU_FREE(schReqList->list.array, schReqList->list.size);
+               DU_FREE(schedulingRequestConfig->schedulingRequestToAddModList,\
+                               sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList));
+               DU_FREE(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
+
+               DU_FREE(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
+
+               tagConfig = macCellGrpCfg->tag_Config;
+               tagList = tagConfig->tag_ToAddModList;
+               for(idx=0; idx<tagList->list.count; idx++)
+               {
+                       DU_FREE(tagList->list.array[idx], sizeof(struct TAG));
+               }
+               DU_FREE(tagList->list.array, tagList->list.size);
+               DU_FREE(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
+               DU_FREE(tagConfig, sizeof(struct TAG_Config));
+
+               phrConfig = macCellGrpCfg->phr_Config;
+               DU_FREE(phrConfig->choice.setup, sizeof(struct PHR_Config));
+               DU_FREE(phrConfig, sizeof(struct MAC_CellGroupConfig__phr_Config));
+
+               DU_FREE(macCellGrpCfg, sizeof(MAC_CellGroupConfig_t));
+       }
+
+       phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig;
+       if(phyCellGrpCfg)
+       {
+               DU_FREE(phyCellGrpCfg->p_NR_FR1, sizeof(long));
+               DU_FREE(phyCellGrpCfg, sizeof(PhysicalCellGroupConfig_t));
+
+       }
+
+       spCellCfg = cellGrpCfg->spCellConfig;
+       if(spCellCfg)
+       {
+               DU_FREE(spCellCfg->servCellIndex, sizeof(long));
+               DU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
+
+               srvCellCfg = spCellCfg->spCellConfigDedicated;
+
+               DU_FREE(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
+
+               DU_FREE(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
+               DU_FREE(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
+
+
+               DU_FREE(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));
+
+
+               DU_FREE(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct      ServingCellConfig__pdsch_ServingCellConfig));
+
+
+               DU_FREE(srvCellCfg->csi_MeasConfig, sizeof(struct ServingCellConfig__csi_MeasConfig));
+
+               DU_FREE(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
+               DU_FREE(spCellCfg, sizeof(SpCellConfig_t));
+       }
+
+       return ROK;
+}
+/*******************************************************************
+ *
+ * @brief Builds DU To CU RRC Container 
+ *
+ * @details
+ *
+ *    Function : BuildDuToCuRrcContainer 
+ *
+ *    Functionality: Builds DuToCuRrcContainer
+ *
+ * @params[in] idx, index in F1AP msg
+ *             DuToCuRRCContainer, DuToCuRRCContainer
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildDuToCuRrcContainer(DUtoCURRCContainer_t *duToCuRrcContainer)
+{
+       CellGroupConfigRrc_t  cellGrpCfg;
+       asn_enc_rval_t        encRetVal;
+
+
+       while(1)
+       {
+               duToCuRrcContainer     = NULLP;
+               cellGrpCfg.cellGroupId = CELL_GRP_ID;
+
+               cellGrpCfg.rlc_BearerToAddModList = NULLP;
+               DU_ALLOC(cellGrpCfg.rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
+               if(!cellGrpCfg.rlc_BearerToAddModList)
+               {
+                       DU_LOG("\nF1AP : Memory allocation failure in BuildDuToCuRrcContainer");
+                       break;
+               }
+               if(BuildRlcBearerToAddModList(cellGrpCfg.rlc_BearerToAddModList) != ROK)
+               {
+                       DU_LOG("\nF1AP : BuildRlcBearerToAddModList failed");
+                       break;
+               }
+
+       cellGrpCfg.rlc_BearerToReleaseList = NULLP;
+               cellGrpCfg.mac_CellGroupConfig = NULLP;
+               DU_ALLOC(cellGrpCfg.mac_CellGroupConfig, sizeof(MAC_CellGroupConfig_t));
+               if(!cellGrpCfg.mac_CellGroupConfig)
+               {
+                       DU_LOG("\nF1AP : Memory allocation failure in BuildDuToCuRrcContainer");
+                       break;
+               }
+               if(BuildMacCellGrpCfg(cellGrpCfg.mac_CellGroupConfig) != ROK)
+               {
+                       DU_LOG("\nF1AP : BuildMacCellGrpCfg failed");
+                       break;
+               }
+
+
+               cellGrpCfg.physicalCellGroupConfig = NULLP;
+               DU_ALLOC(cellGrpCfg.physicalCellGroupConfig, sizeof(PhysicalCellGroupConfig_t));
+               if(!cellGrpCfg.physicalCellGroupConfig)
+               {
+                       DU_LOG("\nF1AP : Memory allocation failure in BuildDuToCuRrcContainer");
+                       break;
+               }
+               if(BuildPhyCellGrpCfg(cellGrpCfg.physicalCellGroupConfig) != ROK)
+               {
+                       DU_LOG("\nF1AP : BuildPhyCellGrpCfg failed");
+                       break;
+               }
+
+               cellGrpCfg.spCellConfig = NULLP;
+               DU_ALLOC(cellGrpCfg.spCellConfig, sizeof(SpCellConfig_t));
+               if(!cellGrpCfg.spCellConfig)
+               {
+                       DU_LOG("\nF1AP : Memory allocation failure in BuildDuToCuRrcContainer");
+                       break;
+               }
+               if(BuildSpCellCfg(cellGrpCfg.spCellConfig) != ROK)
+               {
+                       DU_LOG("\nF1AP : BuildSpCellCfg failed");
+                       break;
+               }
+
+               /* encode cellGrpCfg into duToCuRrcContainer */
+               xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, &cellGrpCfg);
+               cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN);
+               encBufSize = 0;
+               encRetVal = aper_encode(&asn_DEF_CellGroupConfigRrc, 0, &cellGrpCfg, PrepFinalEncBuf, encBuf);
+               /* Encode results */
+               if(encRetVal.encoded == ENCODE_FAIL)
+               {
+                       DU_LOG( "\n F1AP : Could not encode DuToCuRrcContainer (at %s)\n",\
+                                       encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+                       break;
+               }
+               else
+               {
+                       DU_LOG("\n F1AP : Created APER encoded buffer for DuToCuRrcContainer\n");
+                       for(int i=0; i< encBufSize; i++)
+                       {
+                               printf("%x",encBuf[i]);
+                       }
+               }
+
+               memcpy(duToCuRrcContainer, encBuf, encBufSize);
+               break;
+       }
+       FreeMemDuToCuRrcCont(&cellGrpCfg);
+       return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds and sends the InitialULRRCMessage 
+ *
+ * @details
+ *
+ *    Function : BuildAndSendInitialRrcMsgTransfer 
+ *
+ *    Functionality: Constructs the Initial UL RRC Message Transfer and sends
+ *                   it to the CU through SCTP.
+ *
+ * @params[in] 
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti,
+               uint8_t *rrcContainer)
+{
+   S16  ret;
+       U8   elementCnt;
+   U8   ieId;
+       U8   idx;
+       U8   idx1;
+       F1AP_PDU_t  *f1apMsg = NULLP;
+       InitialULRRCMessageTransfer_t *initULRRCMsg=NULLP;
+   asn_enc_rval_t                encRetVal;
+       bool  checkvar=false;
+       while(1)
+       {
+            DU_LOG("\n F1AP : Building RRC Setup Request\n");
+                 DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
+                 if(f1apMsg == NULLP)
+                 {
+                     DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
+                          break;
+                 }
+                 f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
+                 DU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
+                 if(f1apMsg->choice.initiatingMessage == NULLP)
+                 {
+                    DU_LOG(" F1AP : Memory allocation for  F1AP-PDU failed");
+                         break;
+                 }
+                 f1apMsg->choice.initiatingMessage->procedureCode =\
+                        ProcedureCode_id_InitialULRRCMessageTransfer;
+                 f1apMsg->choice.initiatingMessage->criticality = Criticality_ignore;
+                 f1apMsg->choice.initiatingMessage->value.present = \
+                        InitiatingMessage__value_PR_InitialULRRCMessageTransfer;
+                 initULRRCMsg =\
+                        &f1apMsg->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer;
+        elementCnt = 3;
+                 initULRRCMsg->protocolIEs.list.count = elementCnt;
+                 initULRRCMsg->protocolIEs.list.size = \
+                        elementCnt * sizeof(InitialULRRCMessageTransferIEs_t *);
+                 /* Initialize the F1Setup members */
+                  DU_ALLOC(initULRRCMsg->protocolIEs.list.array,initULRRCMsg->protocolIEs.list.size);
+                  if(initULRRCMsg->protocolIEs.list.array == NULLP)
+                  {
+                     DU_LOG(" F1AP : Memory allocation for\
+                               RRCSetupRequestMessageTransferIEs failed");
+                               break;
+                  }
+                  for(idx=0; idx<elementCnt; idx++)
+             {
+                          DU_ALLOC(initULRRCMsg->protocolIEs.list.array[idx],\
+                                sizeof(InitialULRRCMessageTransferIEs_t));
+                                if(initULRRCMsg->protocolIEs.list.array[idx] == NULLP)
+                                {
+                                    break;
+                                }
+                  }
+                  idx1 = 0;
+                  /*GNB DU UE F1AP ID*/
+                  initULRRCMsg->protocolIEs.list.array[idx1]->id  = \
+                                     ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+                       initULRRCMsg->protocolIEs.list.array[idx1]->criticality  = Criticality_reject;
+                  initULRRCMsg->protocolIEs.list.array[idx1]->value.present = \
+                                     InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
+                  initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
+
+
+                       /*NRCGI*/
+                       idx1++;
+                       initULRRCMsg->protocolIEs.list.array[idx1]->id  = \
+                                ProtocolIE_ID_id_NRCGI;
+                       initULRRCMsg->protocolIEs.list.array[idx1]->criticality  =Criticality_reject;
+                       initULRRCMsg->protocolIEs.list.array[idx1]->value.present = \
+                       InitialULRRCMessageTransferIEs__value_PR_NRCGI;
+                  
+                       ret =\
+                       BuildNrcgi(&initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.NRCGI);
+             if(ret!=ROK)
+                       {
+                           break;
+                       }
+
+                       /*CRNTI*/
+                       idx1++;
+                       initULRRCMsg->protocolIEs.list.array[idx1]->id  = \
+                                      ProtocolIE_ID_id_C_RNTI;
+                       initULRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
+                       initULRRCMsg->protocolIEs.list.array[idx1]->value.present =\
+                                InitialULRRCMessageTransferIEs__value_PR_C_RNTI;
+                       initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.C_RNTI = crnti;
+
+         /*RRCContainer*/
+                       idx1++;
+                       initULRRCMsg->protocolIEs.list.array[idx1]->id  = \
+                                      ProtocolIE_ID_id_RRCContainer;
+                       initULRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
+                       initULRRCMsg->protocolIEs.list.array[idx1]->value.present =\
+                                InitialULRRCMessageTransferIEs__value_PR_RRCContainer;
+                                                               
+                       initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size =\
+                                                     strlen((const char*)rrcContainer);
+         DU_ALLOC(initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf,
+                                       initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size)
+                       if(!initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf)
+                       {
+                     DU_LOG(" F1AP : Memory allocation for RRCSetupRequestMessageTransferIEs failed");
+                               break;
+
+                       }
+         memcpy(initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf, rrcContainer,
+                                       initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size);
+
+
+                       /*DUtoCURRCContainer*/
+                       idx1++;
+                       initULRRCMsg->protocolIEs.list.array[idx1]->id  = \
+                                      ProtocolIE_ID_id_DUtoCURRCContainer;
+                       initULRRCMsg->protocolIEs.list.array[idx1]->criticality = Criticality_reject;
+                       initULRRCMsg->protocolIEs.list.array[idx1]->value.present =\
+                                InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer;
+
+                       BuildDuToCuRrcContainer(&initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.DUtoCURRCContainer);
+
+                       xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+                       /* Encode the F1SetupRequest type as APER */
+                       cmMemset((U8 *)encBuf, 0, ENC_BUF_MAX_LEN);
+                       encBufSize = 0;
+                       encRetVal = aper_encode(&asn_DEF_F1AP_PDU, 0, f1apMsg, PrepFinalEncBuf, encBuf);
+                       /* Encode results */
+                       if(encRetVal.encoded == ENCODE_FAIL)
+                       {
+                           DU_LOG( "\n F1AP : Could not encode Initial UL RRC Message Transfer\
+                                structure (at %s)\n",encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+                                break;
+                       }
+                       else
+                       {
+                           
+                                 DU_LOG("\n F1AP : Created APER encoded buffer for Initial UL RRC\
+                                 Message transfer\n");
+                                  for(int i=0; i< encBufSize; i++)
+                                       {
+                                           printf("%x",encBuf[i]);
+                                       }
+                       }
+                       /* Sending  msg  */
+                       if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL) != ROK)
+                       {
+                           DU_LOG("\n F1AP : Sending Initial UL RRC Message Transfer Failed");
+                                break;
+                       }
+                       checkvar=true;
+                       break;
+       }
+   
+       if(f1apMsg != NULLP)
+   {
+           if(f1apMsg->choice.initiatingMessage != NULLP)
+                {
+                    if(initULRRCMsg->protocolIEs.list.array != NULLP)
+                         {
+                        if(idx == elementCnt)
+                             {
+                                      idx1=1;
+                                 if(initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.NRCGI.pLMN_Identity.buf!=NULLP)
+                                      {
+                                          if(initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.NRCGI.nRCellIdentity.buf!=NULLP)
+                                               {
+                                                   DU_FREE(initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.NRCGI.nRCellIdentity.buf,
+                                                        initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.NRCGI.nRCellIdentity.size);
+                                               }
+                                               DU_FREE(initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.NRCGI.pLMN_Identity.buf,\
+                                                initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.NRCGI.pLMN_Identity.size);
+                                       }
+
+                                                 idx1=3;
+                                                 if(initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf)
+                                                 {
+                                                         DU_FREE(initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.buf,
+                                                                         initULRRCMsg->protocolIEs.list.array[idx1]->value.choice.RRCContainer.size)
+                                                 }
+                                       for(ieId=0; ieId<elementCnt; ieId++)
+                                       {
+                                          DU_FREE(initULRRCMsg->protocolIEs.list.array[ieId],sizeof(InitialULRRCMessageTransferIEs_t));
+                                       }
+                              }
+                              else
+                              {
+                                   for(ieId=0; ieId<idx; ieId++)
+                                             {
+                                                 DU_FREE(initULRRCMsg->protocolIEs.list.array[ieId],sizeof(InitialULRRCMessageTransferIEs_t));
+                                             }
+                              }
+                                        DU_FREE(initULRRCMsg->protocolIEs.list.array,initULRRCMsg->protocolIEs.list.size);
+                        }
+                        DU_FREE(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
+                }
+                DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
+       }
+       if(checkvar==true)
+          return ROK;
+       else
+          return RFAILED;
+}/* End of BuildAndSendInitialRrcMsgTransfer*/
+
+/*******************************************************************
+ *
+ * @brief Builds Special cell list for UE Setup Request 
+ *
+ * @details
+ *
+ *    Function : BuildSplCellList
+ *
+ *    Functionality: Constructs the Special Cell list for UESetReq
+ *
+ * @params[in] SCell_ToBeSetup_List_t *spCellLst
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+S16 BuildSplCellList(SCell_ToBeSetup_List_t *spCellLst)
+{
+       U8  cellCnt;
+       U8  idx;
+       S16 ret;
+       cellCnt = 1;
+       spCellLst->list.count = cellCnt;
+       spCellLst->list.size = cellCnt * sizeof(SCell_ToBeSetup_ItemIEs_t *);
+       DU_ALLOC(spCellLst->list.array,spCellLst->list.size);
+       if(spCellLst->list.array == NULLP)
+       {
+               return RFAILED;
+       }
+       for(idx=0; idx<cellCnt; idx++)
+       {
+               DU_ALLOC(spCellLst->list.array[idx],sizeof(SCell_ToBeSetup_ItemIEs_t));
+               if(spCellLst->list.array[idx] == NULLP)
+               {
+                       return RFAILED;
+               }
+       }
+       idx = 0;
+       spCellLst->list.array[idx]->id = ProtocolIE_ID_id_SCell_ToBeSetup_Item;
+       spCellLst->list.array[idx]->criticality = Criticality_ignore;
+       spCellLst->list.array[idx]->value.present =\
+               SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item;
+       /* Special Cell ID -NRCGI */
+       ret = BuildNrcgi(&spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCell_ID);
+       if(ret != ROK)
+       {
+               return RFAILED;
+       }
+       /*Special Cell Index*/
+       spCellLst->list.array[idx]->value.choice.SCell_ToBeSetup_Item.sCellIndex = 1;
+  return ROK;  
+}/* End of BuildSplCellList*/
+
+/*******************************************************************
+ *
+ * @brief Builds SRBS to be setup 
+ *
+ * @details
+ *
+ *    Function : BuildSRBSetup
+ *
  *    Functionality: Constructs the SRB's for UESetReq
  *
  * @params[in] SRBs_ToBeSetup_List_t *srbSet
@@ -3237,7 +4275,26 @@ void F1APMsgHdlr(Buffer *mBuf)
          }/* End of switch(successfulOutcome) */
          break;
       }
-      
+               case F1AP_PDU_PR_initiatingMessage:
+               {
+                       switch(f1apMsg->choice.initiatingMessage->value.present)
+                       {
+                               case InitiatingMessage__value_PR_DLRRCMessageTransfer:
+                                       {
+                                               procDlRrcMsgTrans(f1apMsg);
+                                               break;
+                                       }
+
+                               default:
+                                       {
+                                               DU_LOG("\nF1AP : Invalid type of initiating message[%d]",
+                                                               f1apMsg->choice.initiatingMessage->value.present);
+                                               return;
+                                       }
+                       }/* End of switch(initiatingMessage) */
+                       break;
+               }
+
       default:
       {
          DU_LOG("\nF1AP : Invalid type of f1apMsg->present [%d]",f1apMsg->present);
@@ -3248,40 +4305,6 @@ void F1APMsgHdlr(Buffer *mBuf)
  
 } /* End of F1APMsgHdlr */
  
-/*******************************************************************
- *
- * @brief Processes GNB DU config update ack
- *
- * @details
- *
- *    Function : procGNBDUCfgUpdAck
- *
- *    Functionality: Processes GNB DU config update ack
- *
- * @params[in] F1AP_PDU_t ASN decoded F1AP message
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-
-S16 procGNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg)
-{
-  
-
-   DU_LOG("\nF1AP : GNB-DU config update acknowledgment received");
-
-    
-   /* TODO :Check the deallocation */
-#if 0
-   SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(gNBDuCfgAck->protocolIEs.list.array),\
-           (Size)elementCnt * sizeof(GNBDUConfigurationUpdateAcknowledgeIEs_t *));
-   SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&(f1apMsg->choice.successfulOutcome),\
-           (Size)sizeof(SuccessfulOutcome_t));
-   SPutSBuf(DU_APP_MEM_REGION,DU_POOL,(Data *)&f1apMsg,(Size)sizeof(F1AP_PDU_t));
-#endif
-    return ROK;
-}
-
 /**********************************************************************
   End of file
  **********************************************************************/
index e071c26..ce2b758 100644 (file)
 
 void F1APMsgHdlr(Buffer *mBuf);
 S16 BuildAndSendF1SetupReq();
-S16 procGNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg);
 S16 BuildAndSendDUConfigUpdate();
+S16 procGNBDUCfgUpdAck(F1AP_PDU_t *f1apMsg);
+uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg);
+uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti, uint8_t *rrcContainer);
+
+
 /**********************************************************************
          End of file
 **********************************************************************/
index 99ceeeb..2b08c77 100644 (file)
@@ -205,6 +205,14 @@ typedef struct duLSapCb
    TmrCfg      bndTmr;
 }DuLSapCb;
 
+typedef struct ueCcchCtxt
+{
+   uint32_t gnbDuUeF1apId; /* GNB DU UE F1AP ID */
+   uint16_t crnti;         /* CRNTI */
+   uint16_t cellId;        /* Cell Id */
+}UeCcchCtxt;
+
+
 /* DU APP DB */
 typedef struct duCb
 {
@@ -217,6 +225,8 @@ typedef struct duCb
    DuCellCb*     actvCellLst[DU_MAX_CELLS];    /* List of cells activated/to be activated of type DuCellCb */
    /* pointer to store the address of macCellCfg params used to send du-app to MAC */
    MacCellCfg     *duMacCellCfg;     /* pointer to store params while sending DU-APP to MAC */
+       uint32_t      numUe;              /* current number of UEs */
+       UeCcchCtxt    ueCcchCtxt[DU_MAX_UE]; /* mapping of gnbDuUeF1apId to CRNTI required for CCCH processing*/
 }DuCb;
 
 
index 3cecb37..10f82dc 100644 (file)
@@ -77,6 +77,8 @@ S16 duActvInit(Ent entity, Inst inst, Region region, Reason reason)
           duCb.cfgCellLst[id] = NULL;
       duCb.actvCellLst[id] = NULL;
    }
+   duCb.numUe = 0;
+       memset(duCb.ueCcchCtxt, 0, DU_MAX_UE * sizeof(UeCcchCtxt));
 
    SSetProcId(DU_PROC);
 
@@ -203,6 +205,12 @@ S16 duActvTsk(Pst *pst, Buffer *mBuf)
                      ret = unpackMacStopInd(duHandleStopInd, pst, mBuf);
                      break;
                   }
+                                       case EVENT_MAC_UL_CCCH_IND:
+                                               {
+                                                       ret = unpackMacUlCcchInd(duHandleUlCcchInd, pst, mBuf);
+                                                       break;
+                                               }
+
                default:
                   {
                      DU_LOG("\nDU_APP : Invalid event received at duActvTsk from ENTRG");
index 305af8b..c56a308 100644 (file)
@@ -21,6 +21,7 @@
 #include "du_mgr.h"
 #include "du_sctp.h"
 #include "du_f1ap_msg_hdl.h"
+#include "du_ue_mgr.h"
 #include "lsctp.h"
 #include "legtp.h"
 #include "lphy_stub.h"
@@ -1816,6 +1817,33 @@ uint16_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellStopId)
 
    return ROK;
 }
+
+/*******************************************************************
+ *
+ * @brief Handles slot indication from MAC
+ *
+ * @details
+ *
+ *    Function : duHandleUlCcchInd
+ *
+ *    Functionality:
+ *      Handles UL CCCH indication from MAC
+ *
+ * @params[in] Post structure pointer
+ *             UL CCCH Ind pointer
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint16_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo)
+{
+   
+   DU_LOG("\nDU APP : UL CCCH Indication received");
+
+   return (duProcUlCcchInd(ulCcchIndInfo));
+}
+
+
 /**********************************************************************
   End of file
  **********************************************************************/
index 2bf2900..40cbdac 100644 (file)
 U32 sduId = 0;
 #endif
 
+DuMacDlCcchInd packMacDlCcchIndOpts[] =
+{
+   packMacDlCcchInd,   /* Loose coupling */
+   MacHdlDlCcchInd,    /* TIght coupling */
+   packMacDlCcchInd    /* Light weight-loose coupling */
+};
+
 /******************************************************************
  *
  * @brief Send UE configuration to RLC
@@ -179,6 +186,219 @@ PUBLIC S16 duHdlRlcUlData(Pst *pst, KwuDatIndInfo* datInd, Buffer *mBuf)
    return ROK;
 }
 
+/******************************************************************
+*
+* @brief Builds and Sends DL CCCH Ind to MAC
+*
+* @details
+*
+*    Function : duBuildAndSendDlCcchInd 
+*
+*    Functionality: Builds and sends DL CCCH Ind Msg to MAC
+*
+* @params[in] dlCcchMsg - uint8_t*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t duBuildAndSendDlCcchInd(uint8_t *dlCcchMsg, uint16_t crnti, uint16_t cellId, DlCcchMsgType msgType)
+{
+   Pst pst;
+       uint8_t ret                  = ROK;
+   DlCcchIndInfo *dlCcchIndInfo = NULLP;
+
+   DU_LOG("\nDU APP : Building and Sending DL CCCH Ind to MAC");
+
+       DU_ALLOC_SHRABL_BUF(dlCcchIndInfo, sizeof(DlCcchIndInfo));
+
+   if(!dlCcchIndInfo)
+   {
+               DU_LOG("\nDU APP : Memory alloc failed while building DL CCCH Ind");
+               return RFAILED;
+       }
+
+       dlCcchIndInfo->cellId = cellId;
+       dlCcchIndInfo->crnti = crnti;
+       dlCcchIndInfo->msgType = msgType;
+       DU_ALLOC_SHRABL_BUF(dlCcchIndInfo->dlCcchMsg, strlen((const char*)dlCcchMsg));
+       if(!dlCcchIndInfo->dlCcchMsg)
+   {
+               DU_LOG("\nDU APP : Memory alloc failed while building DL CCCH Ind");
+               DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, sizeof(DlCcchIndInfo));
+               return RFAILED;
+       }
+       memcpy(dlCcchIndInfo->dlCcchMsg, dlCcchMsg, strlen((const char*)dlCcchMsg));
+       DU_FREE(dlCcchMsg, strlen((const char*)dlCcchMsg));
+
+       /* Fill Pst */
+       pst.selector  = DU_MAC_LWLC;
+       pst.srcEnt    = ENTDUAPP;
+       pst.dstEnt    = ENTRG;
+       pst.dstInst   = 0;
+       pst.srcInst   = 0;
+       pst.dstProcId = DU_PROC;
+       pst.srcProcId = DU_PROC;
+       pst.region    = DU_APP_MEM_REGION;
+       pst.pool      = DU_POOL;
+       pst.event     = EVENT_MAC_DL_CCCH_IND;
+
+   ret = (*packMacDlCcchIndOpts[pst.selector])(&pst, dlCcchIndInfo);
+       if(ret != ROK)
+       {
+      DU_LOG("\nDU_APP : Failure in sending DL CCCH to MAC");
+               DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo->dlCcchMsg, strlen((const char*)dlCcchMsg));
+               DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, dlCcchIndInfo, sizeof(DlCcchIndInfo));
+      ret = RFAILED; 
+       }
+
+       return ret;
+
+}
+
+/******************************************************************
+*
+* @brief Processes DL RRC Message Transfer  sent by CU
+*
+* @details
+*
+*    Function : procDlRrcMsgTrans 
+*
+*    Functionality: Processes DL RRC Message Transfer sent by CU
+*
+* @params[in] F1AP_PDU_t ASN decoded F1AP message
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
+{
+       DLRRCMessageTransfer_t *dlRrcMsg = NULLP;
+       uint8_t                *dlCcchMsg = NULLP;
+       uint8_t                srbId, idx, ret;
+       uint16_t               crnti, cellId;
+       uint32_t               gnbCuUeF1apId, gnbDuUeF1apId;
+
+
+       DU_LOG("\nDU_APP : DL RRC message transfer Recevied");
+       dlRrcMsg = &f1apMsg->choice.initiatingMessage->value.choice.DLRRCMessageTransfer;
+
+       ret = ROK;
+
+       for(idx=0; idx<dlRrcMsg->protocolIEs.list.count; idx++)
+       {
+               switch(dlRrcMsg->protocolIEs.list.array[idx]->id)
+               {
+                       case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                               {
+                                       gnbCuUeF1apId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID;
+                                       UNUSED(gnbCuUeF1apId); //This is currently not used
+                                       break;
+                               }
+                       case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                               {
+                                       gnbDuUeF1apId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
+                                       break;
+                               }
+                       case ProtocolIE_ID_id_SRBID:
+                               {
+                                       srbId = dlRrcMsg->protocolIEs.list.array[idx]->value.choice.SRBID;
+                                       break;
+                               }
+                       case ProtocolIE_ID_id_RRCContainer:
+                               {
+                                  DU_ALLOC(dlCcchMsg, dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
+                                       memcpy(dlCcchMsg,
+                                                       dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf,
+                                                       dlRrcMsg->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
+                                       break;
+                               }
+
+                       default:
+                               DU_LOG("\nDU_APP : Invalid IE received in DL RRC Msg Transfer:%ld",
+                                               dlRrcMsg->protocolIEs.list.array[idx]->id);
+               }
+       }
+   
+   for(idx=0; idx<duCb.numUe; idx++)
+       {
+      if(gnbDuUeF1apId == duCb.ueCcchCtxt[idx].gnbDuUeF1apId)
+               {
+                  crnti  = duCb.ueCcchCtxt[idx].crnti;
+                       cellId = duCb.ueCcchCtxt[idx].cellId;
+               }
+       }
+       if(srbId == 0) //RRC connection setup
+       {
+               ret = duBuildAndSendDlCcchInd(dlCcchMsg, crnti, cellId, RRC_SETUP);
+       }
+       return ret;
+}
+
+/******************************************************************
+ *
+ * @brief Generates GNB DU Ue F1AP ID
+ *
+ * @details
+ *
+ *    Function : genGnbDuUeF1apId
+ *
+ *    Functionality: Generates GNB DU Ue F1AP ID
+ *
+ * @params[in] void
+ * @return gnbDuF1apId
+ *
+ * ****************************************************************/
+uint32_t genGnbDuUeF1apId()
+{
+       static uint32_t gnbDuUeF1apId = 0;
+
+       return ++gnbDuUeF1apId;
+}
+/******************************************************************
+ *
+ * @brief Processes UL CCCH Ind recvd from MAC
+ *
+ * @details
+ *
+ *    Function : duProcUlCcchInd
+ *
+ *    Functionality: Processes UL CCCH Ind recvd from MAC
+ *
+ * @params[in] UlCcchIndInfo *ulCcchIndInfo
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo)
+{
+
+   uint8_t ret = ROK;
+       uint32_t gnbDuUeF1apId = 0;
+
+       gnbDuUeF1apId = genGnbDuUeF1apId();
+
+       /* Store Ue mapping */
+       duCb.ueCcchCtxt[duCb.numUe].gnbDuUeF1apId = gnbDuUeF1apId;
+       duCb.ueCcchCtxt[duCb.numUe].crnti         = ulCcchIndInfo->crnti;
+       duCb.ueCcchCtxt[duCb.numUe].cellId        = ulCcchIndInfo->cellId;
+
+       duCb.numUe++;
+
+   ret = (BuildAndSendInitialRrcMsgTransfer(gnbDuUeF1apId, ulCcchIndInfo->crnti,
+                               ulCcchIndInfo->ulCcchMsg));
+       if(ret != ROK)
+       {
+      DU_LOG("\nDU_APP : BuildAndSendInitialRrcMsgTransfer failed");
+       }
+
+   DU_FREE_SHRABL_BUF(MAC_MEM_REGION, RG_POOL, ulCcchIndInfo->ulCcchMsg, strlen((const char*)ulCcchIndInfo->ulCcchMsg));
+   DU_FREE_SHRABL_BUF(MAC_MEM_REGION, RG_POOL, ulCcchIndInfo, sizeof(UlCcchIndInfo));
+
+       return ret;
+
+}
+
+
 /**********************************************************************
          End of file
 ***********************************************************************/
index fa55370..5659c97 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "du_mgr.h"
 #include "du_log.h"
+#include "du_f1ap_msg_hdl.h"
 #include "ckw.h"
 #include "kwu.h"
 
@@ -33,6 +34,7 @@ S16 duHdlEgtpDlData(EgtpMsg  *egtpMsg);
 S16 duHdlRlcUlData(Pst *pst, KwuDatIndInfo* datInd, Buffer *mBuf);
 S16 packUeCreateReq(Pst *pst,CkwCfgInfo *cfgInfo);
 S16 cmPkKwuDatReq(Pst * pst,KwuDatReqInfo* datReq,Buffer * mBuf);
+uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo);
 #endif
 
 /**********************************************************************