[JIRA ID: ODUHIGH-242] RB configuration for Ue Context Setup for RLC 76/4876/11
authorsphoorthi <sphoorthi.dayanand@radisys.com>
Wed, 21 Oct 2020 15:57:19 +0000 (21:27 +0530)
committersphoorthi <sphoorthi.dayanand@radisys.com>
Wed, 4 Nov 2020 15:25:57 +0000 (20:55 +0530)
Change-Id: I73c287921494f9028b7fdc99d118292a61bccd22
Signed-off-by: sphoorthi <sphoorthi.dayanand@radisys.com>
30 files changed:
src/5gnrmac/mac_ue_mgr.c
src/5gnrmac/rg_ex_ms.c
src/5gnrrlc/kw.x
src/5gnrrlc/kw_udx_ul.c
src/5gnrrlc/kw_uim.c
src/5gnrrlc/kw_ul_ex_ms.c
src/5gnrrlc/rlc_mgr.c
src/5gnrrlc/rlc_mgr.h
src/5gnrrlc/rlc_msg_hdl.c
src/5gnrsch/sch.c
src/5gnrsch/sch_common.c
src/5gnrsch/sch_rach.c
src/5gnrsch/sch_ue_mgr.c
src/5gnrsch/sch_utils.h
src/cm/common_def.c
src/cm/common_def.h
src/cm/du_app_mac_inf.c
src/cm/du_app_mac_inf.h
src/cm/du_app_rlc_inf.c
src/cm/du_app_rlc_inf.h
src/cm/mac_sch_interface.c
src/cm/mac_sch_interface.h
src/codec_utils/common/odu_common_codec.c
src/codec_utils/common/odu_common_codec.h
src/cu_stub/cu_f1ap_msg_hdl.c
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_ue_mgr.c

index f901ce9..108cc03 100644 (file)
@@ -36,11 +36,18 @@ MacSchUeCreateReqFunc macSchUeCreateReqOpts[] =
    packMacSchUeCreateReq     /* packing for light weight loosely coupled */
 };
 
-DuMacUeCreateRspFunc DuMacUeCreateRspOpts[] =
+MacDuUeCfgRspFunc MacDuUeCfgRspOpts[] =
 {
-   packDuMacUeCreateRsp,     /* packing for loosely coupled */
-   DuHandleMacUeCreateRsp,   /* packing for tightly coupled */
-   packDuMacUeCreateRsp,     /* packing for light weight loosly coupled */
+   packDuMacUeCfgRsp,   /* packing for loosely coupled */
+   DuProcMacUeCfgRsp,   /* packing for tightly coupled */
+   packDuMacUeCfgRsp   /* packing for light weight loosly coupled */
+};
+
+MacSchUeReconfigReqFunc macSchUeReconfigReqOpts[] =
+{
+   packMacSchUeReconfigReq,    /* packing for loosely coupled */
+   MacSchUeReconfigReq,        /* packing for tightly coupled */
+   packMacSchUeReconfigReq     /* packing for light weight loosely coupled */
 };
 
 /*******************************************************************
@@ -160,31 +167,79 @@ uint8_t fillPhyCellGroupCfg(PhyCellGrpCfg macUeCfg, SchPhyCellGrpCfg *schPhyCell
  * ****************************************************************/
 uint8_t fillPdschServCellCfg(PdschServCellCfg macPdschCfg, SchPdschServCellCfg *schPdschCfg) 
 {
-   schPdschCfg->maxMimoLayers = NULL;
    if(macPdschCfg.maxMimoLayers)
    {
-      /* TODO : Optional parameter */
+      if(!schPdschCfg->maxMimoLayers)
+      {
+         MAC_ALLOC_SHRABL_BUF(schPdschCfg->maxMimoLayers, sizeof(uint8_t));
+        if(!schPdschCfg->maxMimoLayers)
+        {
+            DU_LOG("\nMAC :Memory Alloc MimoLayers Failed at fillPdschServCellCfg()");
+           return RFAILED;
+        }
+      }
+      *schPdschCfg->maxMimoLayers = *macPdschCfg.maxMimoLayers;
+   }
+   else
+   {
+      schPdschCfg->maxMimoLayers = NULLP;
    }
 
    schPdschCfg->numHarqProcForPdsch = \
       macPdschCfg.numHarqProcForPdsch;
 
-   schPdschCfg->maxCodeBlkGrpPerTb = NULL;
    if(macPdschCfg.maxCodeBlkGrpPerTb)
    {
-      /* TODO : Optional parameter */
+      if(!schPdschCfg->maxCodeBlkGrpPerTb)
+      {
+         MAC_ALLOC_SHRABL_BUF(schPdschCfg->maxCodeBlkGrpPerTb, sizeof(SchMaxCodeBlkGrpPerTB));
+        if(!schPdschCfg->maxCodeBlkGrpPerTb)
+        {
+            DU_LOG("\nMAC :Memory Alloc for code Block Failed at fillPdschServCellCfg()");
+           return RFAILED;
+        }
+      }
+      *schPdschCfg->maxCodeBlkGrpPerTb = *macPdschCfg.maxCodeBlkGrpPerTb;
+   }
+   else
+   {
+      schPdschCfg->maxCodeBlkGrpPerTb = NULLP;
    }
 
-   schPdschCfg->codeBlkGrpFlushInd = NULL;
    if(macPdschCfg.codeBlkGrpFlushInd)
    {
-      /* TODO : Optional parameter */
+      if(!schPdschCfg->codeBlkGrpFlushInd)
+      {
+         MAC_ALLOC_SHRABL_BUF(schPdschCfg->codeBlkGrpFlushInd, sizeof(bool));
+        if(!schPdschCfg->codeBlkGrpFlushInd)
+        {
+            DU_LOG("\nMAC :Memory Alloc for Flush Ind Failed at fillPdschServCellCfg()");
+           return RFAILED;
+        }
+      }
+      *schPdschCfg->codeBlkGrpFlushInd = *macPdschCfg.codeBlkGrpFlushInd;
+   }
+   else
+   {
+      schPdschCfg->codeBlkGrpFlushInd = NULLP;
    }
 
-   schPdschCfg->xOverhead = NULL;
    if(macPdschCfg.xOverhead)
    {
-      /* TODO : Optional parameter */
+      if(!schPdschCfg->xOverhead)
+      {
+         MAC_ALLOC_SHRABL_BUF(schPdschCfg->xOverhead, sizeof(SchPdschXOverhead));
+        if(!schPdschCfg->xOverhead)
+        {
+            DU_LOG("\nMAC :Memory Alloc for xOverHead Failed at fillPdschServCellCfg()");
+           return RFAILED;
+        }
+      }
+      *schPdschCfg->xOverhead = *macPdschCfg.xOverhead;
+   }
+   else
+   {
+      schPdschCfg->xOverhead = NULLP;
    }
 
    return ROK;
@@ -211,6 +266,7 @@ uint8_t fillInitalUlBwpPuschCfg(PuschCfg macPuschCfg, SchPuschCfg *schPuschCfg)
 {
    uint8_t   idx;
 
+   schPuschCfg->dataScramblingId = macPuschCfg.dataScramblingId;
    schPuschCfg->dmrsUlCfgForPuschMapTypeA.addPos = \
       macPuschCfg.dmrsUlCfgForPuschMapTypeA.addPos;
    schPuschCfg->dmrsUlCfgForPuschMapTypeA.transPrecodDisabled.scramblingId0 = \
@@ -430,7 +486,15 @@ uint8_t fillInitDlBwpPdschCfg(PdschConfig macPdschCfg, SchPdschConfig *schPdschC
    schPdschCfg->rbgSize = macPdschCfg.rbgSize;
    schPdschCfg->numCodeWordsSchByDci = macPdschCfg.numCodeWordsSchByDci;
    schPdschCfg->bundlingType = macPdschCfg.bundlingType;
-
+   if(schPdschCfg->bundlingType == STATIC_BUNDLING_TYPE)
+   {
+      schPdschCfg->bundlingInfo.SchStaticBundling.size  = macPdschCfg.bundlingInfo.StaticBundling.size;
+   }
+   else if(schPdschCfg->bundlingType == DYNAMIC_BUNDLING_TYPE)
+   {
+      schPdschCfg->bundlingInfo.SchDynamicBundling.sizeSet1 = macPdschCfg.bundlingInfo.DynamicBundling.sizeSet1;
+      schPdschCfg->bundlingInfo.SchDynamicBundling.sizeSet2 = macPdschCfg.bundlingInfo.DynamicBundling.sizeSet2;
+   }
    return ROK;
 }
 
@@ -592,12 +656,6 @@ uint8_t fillLogicalChannelCfg(LcCfg macLcCfg, SchLcCfg *schLcCfg)
       /* TODO : Optional Parameter */
    }
 
-   schLcCfg->ulLcCfg = NULL;
-   if(macLcCfg.ulLcCfg)
-   {
-      /* TODO : Optional Parameter */
-   }
-
    return ROK;
 }
 
@@ -679,7 +737,7 @@ uint8_t sendAddUeCreateReqToSch(MacUeCfg *ueCfg)
    }
 
    /* Fill event and send UE create request to SCH */
-   FILL_PST_MAC_TO_SCH(pst, EVENT_UE_CREATE_REQ_TO_SCH);
+   FILL_PST_MAC_TO_SCH(pst, EVENT_UE_CONFIG_REQ_TO_SCH);
    return(*macSchUeCreateReqOpts[pst.selector])(&pst, &schUeCfg);
 }
 
@@ -975,9 +1033,8 @@ uint8_t MacSendUeCreateRsp(MacRsp result, SchUeCfgRsp *schCfgRsp)
 
    /* Fill Post structure and send UE Create response*/
    memset(&rspPst, 0, sizeof(Pst));
-   FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_UE_CREATE_RSP);
-   return DuMacUeCreateRspOpts[rspPst.selector](&rspPst, cfgRsp); 
-
+   FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_UE_CONFIG_RSP);
+   return MacDuUeCfgRspOpts[rspPst.selector](&rspPst, cfgRsp); 
 }
 
 
@@ -1023,6 +1080,27 @@ uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *schCfgRsp)
    return ret; 
 }
 
+/*******************************************************************
+ *
+ * @brief Handles UE Reconfig requst from DU APP
+ *
+ * @details
+ *
+ *    Function : MacProcUeReconfigReq
+ *
+ *    Functionality: Handles UE Reconfig requst from DU APP
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg)
+{
+   //TODO:
+   return ROK;
+}
+
 
 /**********************************************************************
   End of file
index 31e0fda..7bad72d 100755 (executable)
@@ -124,10 +124,14 @@ Buffer  *mBuf;                      /* message buffer       */
                        /* Process DL CCCH Ind */
                        unpackMacDlCcchInd(MacProcDlCcchInd, pst, mBuf);
                        break;
-               case EVENT_MAC_UE_CREATE_REQ:
+               case EVENT_MAC_UE_CONFIG_REQ:
                   /* Process Ue Create Request */
                        unpackMacUeCreateReq(MacProcUeCreateReq, pst, mBuf);
                        break;
+                case EVENT_MAC_UE_RECONFIG_REQ:
+                  /* Process Ue Reconfig Request */
+                       unpackMacUeReconfigReq(MacProcUeReconfigReq, pst, mBuf);
+                       break;
       default:
          RG_FREE_MSG(mBuf);
          break;
index 32adab2..ebad650 100755 (executable)
@@ -574,6 +574,7 @@ typedef struct rlcUlCb
    CmHashListCp   cellLstCp;      /*!< Hashlist of CellCb */
    CmHashListCp   ueLstCp;        /*!< Hashlist of UeCb */
    CmHashListCp   transIdLstCp;   /*!< Hashlist of cfg trans */
+   uint8_t        rlcUlUdxEventType;  /*!<Ue Create/ReConfig> */
 /* kw005.201 added support for L2 Measurement */
 #ifdef LTE_L2_MEAS
    RlcL2Cb        rlcL2Cb; /*!< Control Block for L2 Measurements in RLC */
index 710e9fd..3aecc73 100755 (executable)
@@ -282,8 +282,15 @@ RlcCfgCfmInfo   *cfmInfo;
    }
 #endif /* ERRCLASS & ERRCLS_ADD_RES */
    rlcHdlCrlcUlCfgReq(tRlcCb,cfgTmpData, cfmInfo, cfgCfm);
-   FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UL_UE_CREATE_RSP);
-   SendRlcUlUeCreateRspToDu(&rspPst, cfgCfm);
+   if(tRlcCb->u.ulCb->rlcUlUdxEventType == EVENT_RLC_UE_CONFIG_REQ)
+   {
+      FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_CONFIG_RSP);
+   }
+   else if(tRlcCb->u.ulCb->rlcUlUdxEventType == EVENT_RLC_UE_RECONFIG_REQ)
+   {
+      FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_RECONFIG_RSP);
+   }
+   SendRlcUeRspToDu(&rspPst, cfgCfm);
 
    /* free the memory from DL */
    RLC_FREE_SHRABL_BUF(pst->region,
index e3478c9..19a8313 100755 (executable)
@@ -300,6 +300,7 @@ RlcCfgInfo   *cfg;
    cfgTmpData->cfgInfo  = cfg;
 
  
+   tRlcCb->u.ulCb->rlcUlUdxEventType = pst->event;
    if (rlcDbmAddUlTransaction(tRlcCb, cfgTmpData) != ROK)
    {
       RLOG0(L_ERROR, "Addition to UL transId Lst Failed");
index 01fcde0..64b3e3f 100755 (executable)
@@ -237,9 +237,14 @@ Buffer *mBuf;           /* message buffer */
                      break;
                   }
                
-               case EVENT_RLC_UL_UE_CREATE_REQ:        /* UE Create Request */
+               case EVENT_RLC_UE_CONFIG_REQ:        /* UE Create Request */
                   {
-                     ret = unpackRlcUlUeCreateReq(RlcUlProcUeCreateReq, pst, mBuf);
+                     ret = unpackRlcUeCreateReq(RlcProcUeCreateReq, pst, mBuf);
+                     break;
+                  }
+              case EVENT_RLC_UE_RECONFIG_REQ:        /* UE Reconfig Request */
+                  {
+                     ret = unpackRlcUeReconfigReq(RlcProcUeReconfigReq, pst, mBuf);
                      break;
                   }
 
index 14de3d8..ffde7c4 100644 (file)
 #include "du_app_rlc_inf.h"
 #include "rlc_mgr.h"
 
-RlcUlDuUeCreateRsp rlcUlUeCreateRspOpts[] =
+RlcDuUeCfgRsp rlcUeCfgRspOpts[] =
 {
-   packRlcUlDuUeCreateRsp,     /* 0 - loosely coupled */
-   DuProcRlcUlUeCreateRsp,     /* 1 - tightly coupled */
-   packRlcUlDuUeCreateRsp,     /* 2 - LWLC loosely coupled */
+   packRlcDuUeCfgRsp,     /* 0 - loosely coupled */
+   DuProcRlcUeCfgRsp,     /* 1 - tightly coupled */
+   packRlcDuUeCfgRsp     /* 2 - LWLC loosely coupled */
 };
 
 
@@ -62,32 +62,39 @@ RlcUlDuUeCreateRsp rlcUlUeCreateRspOpts[] =
  *      -# RFAILED
  *
  *************************************************************/
-uint8_t SendRlcUlUeCreateRspToDu(Pst *pst, RlcCfgCfmInfo *cfgRsp)
+uint8_t SendRlcUeRspToDu(Pst *pst, RlcCfgCfmInfo *cfgRsp)
 {
    /* jump to specific primitive depending on configured selector */
-   uint8_t ret = ROK;  
-   RlcUeCfgRsp *ueCreateRsp = NULLP;
+   uint8_t ret = ROK;
+   RlcUeCfgRsp *ueRsp = NULLP;
 
-   RLC_ALLOC_SHRABL_BUF(pst->region, pst->pool, ueCreateRsp, sizeof(RlcUeCfgRsp));
-   if(!ueCreateRsp)
+   RLC_ALLOC_SHRABL_BUF(pst->region, pst->pool, ueRsp, sizeof(RlcUeCfgRsp));
+   if(!ueRsp)
    {  
-      DU_LOG("RLC: Memory allocation failed for ueCreateRsp at SendRlcUlUeCreateRspToDu()");
+      DU_LOG("RLC: Memory allocation failed for ueRsp at SendRlcUeCreateRspToDu()");
       ret = RFAILED;
    }
    else
    {
       /* Mapping Old api to New Api */
-      fillRlcUlUeCfgRsp(ueCreateRsp, cfgRsp);
-      ret = (*rlcUlUeCreateRspOpts[pst->selector])(pst, ueCreateRsp);
-      if(ret)
+      ret = fillRlcUeCfgRsp(ueRsp, cfgRsp);
+      if(!ret)
       {
-         DU_LOG("RLC: Failed at SendRlcUlUeCreateRspToDu()");
-         RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCreateRsp, sizeof(RlcUeCfgRsp));
-        ret = RFAILED;
+         ret = (*rlcUeCfgRspOpts[pst->selector])(pst, ueRsp);
+         if(ret)
+         {
+            DU_LOG("RLC: Failed at SendRlcUeRspToDu()");
+            RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueRsp, sizeof(RlcUeCfgRsp));
+         }
+      }
+      else
+      {
+         DU_LOG("RLC: Failed at fillRlcUeCfgRsp() for event %d", pst->event);
+         RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueRsp, sizeof(RlcUeCfgRsp));
       }
    }
    return ret;
-} /* end of SendRlcUlUeCreateRspToDu */
+} /* end of SendRlcUeRspToDu */
 
 /**********************************************************************
          End of file
index 440c10c..fa6bd5a 100644 (file)
@@ -17,8 +17,8 @@
 *******************************************************************************/
 
 /* This file stores defines used at RLC interface */
-extern void fillRlcUlUeCfgRsp(RlcUeCfgRsp *rlcCfgRsp, RlcCfgCfmInfo *rlcCRsp);
-uint8_t SendRlcUlUeCreateRspToDu(Pst *pst, RlcCfgCfmInfo *cfgRsp);
+uint8_t fillRlcUeCfgRsp(RlcUeCfgRsp *rlcCfgRsp, RlcCfgCfmInfo *rlcCRsp);
+uint8_t SendRlcUeRspToDu(Pst *pst, RlcCfgCfmInfo *cfgRsp);
 
 /**********************************************************************
          End of file
index 0e296ce..e7085d0 100644 (file)
@@ -49,7 +49,7 @@
  *
  * @details
  *
- *    Function : fillRlcUlUeCfgRsp
+ *    Function : fillRlcUeCfgRsp
  *
  *    Functionality: 
  *     Fills RLC UL UE Cfg Rsp from RlcCRsp
  *  @params[in]  Pointer to RlcCfgCfm
  *               Pointer to RlcUeCfgRsp
  *
- *  @return void
+ *  @return ROK/RFAILED
  * 
  *****************************************************************/
 
-void fillRlcUlUeCfgRsp(RlcUeCfgRsp *rlcCfgRsp, RlcCfgCfmInfo *rlcCRsp)
+uint8_t fillRlcUeCfgRsp(RlcUeCfgRsp *rlcCfgRsp, RlcCfgCfmInfo *rlcCRsp)
 {
    uint8_t idx;
+   uint8_t ret = ROK;
  
    rlcCfgRsp->cellId = rlcCRsp->cellId;
    rlcCfgRsp->ueIdx  = rlcCRsp->ueId;
@@ -73,13 +74,17 @@ void fillRlcUlUeCfgRsp(RlcUeCfgRsp *rlcCfgRsp, RlcCfgCfmInfo *rlcCRsp)
       {
          rlcCfgRsp->result = RLC_DU_APP_RSP_OK;
         rlcCfgRsp->reason = rlcCRsp->entCfgCfm[idx].status.reason;
+        ret = ROK;
       }
       else
       {
          rlcCfgRsp->result = RLC_DU_APP_RSP_NOK;
         rlcCfgRsp->reason = rlcCRsp->entCfgCfm[idx].status.reason;
+        ret = RFAILED;
+        break;
       }
    }
+   return ret;
 }
 
 /*******************************************************************
@@ -124,13 +129,111 @@ void fillEntModeAndDir(uint8_t *entMode, uint8_t *direction, RlcMode rlcMode)
     break;
    }
 }
+
+/*******************************************************************
+ *
+ * @brief fills LC Cfgs to be Added in RLC
+ *
+ * @details
+ *
+ *    Function : fillLcCfg
+ *
+ *    Functionality:
+ *      fills LC Cfgs to be Added in RLC
+ *
+ * @params[in] 
+ *             RlcEntCfgInfo pointer
+ *             RlcBearerCfg pointer
+ *             Config Type 
+ * @return void
+ *
+ * ****************************************************************/
+void fillLcCfg(RlcEntCfgInfo *rlcUeCfg, RlcBearerCfg *duRlcUeCfg, uint8_t cfgType)
+{
+   uint8_t lChRbIdx = 0;
+
+   rlcUeCfg->rbId                  = duRlcUeCfg->rbId;
+   rlcUeCfg->rbType                = duRlcUeCfg->rbType;   // SRB or DRB
+   rlcUeCfg->lCh[lChRbIdx].lChId   = duRlcUeCfg->lcId;   
+   rlcUeCfg->lCh[lChRbIdx].type    = duRlcUeCfg->lcType;
+   fillEntModeAndDir(&rlcUeCfg->entMode, &rlcUeCfg->dir, duRlcUeCfg->rlcMode);
+   rlcUeCfg->cfgType               = cfgType;
+   switch(rlcUeCfg->entMode)
+   {
+
+      case CM_LTE_MODE_AM:
+         {
+            /* DL AM INFO */
+            rlcUeCfg->m.amInfo.dl.snLen       = duRlcUeCfg->u.amCfg->dlAmCfg.snLenDl; 
+            rlcUeCfg->m.amInfo.dl.pollRetxTmr = duRlcUeCfg->u.amCfg->dlAmCfg.pollRetxTmr;
+            rlcUeCfg->m.amInfo.dl.pollPdu     = duRlcUeCfg->u.amCfg->dlAmCfg.pollPdu; 
+            rlcUeCfg->m.amInfo.dl.pollByte    = duRlcUeCfg->u.amCfg->dlAmCfg.pollByte; 
+            rlcUeCfg->m.amInfo.dl.maxRetx     = duRlcUeCfg->u.amCfg->dlAmCfg.maxRetxTh;
+
+            /* UL AM INFO */
+            lChRbIdx++;   //lChRbIdx = 1, indicates UL AM
+            rlcUeCfg->lCh[lChRbIdx].lChId    = duRlcUeCfg->lcId;   
+            rlcUeCfg->lCh[lChRbIdx].type     = duRlcUeCfg->lcType;
+            rlcUeCfg->m.amInfo.ul.snLen      = duRlcUeCfg->u.amCfg->ulAmCfg.snLenUl; 
+            rlcUeCfg->m.amInfo.ul.staProhTmr = duRlcUeCfg->u.amCfg->ulAmCfg.statProhTmr;
+            rlcUeCfg->m.amInfo.ul.reOrdTmr   = duRlcUeCfg->u.amCfg->ulAmCfg.reAssemTmr;
+            break;
+         }
+      case CM_LTE_MODE_UM:
+         {
+            /* UL UM CONFIG */
+            rlcUeCfg->m.umInfo.ul.snLen    = duRlcUeCfg->u.umBiDirCfg->ulUmCfg.snLenUlUm; 
+            rlcUeCfg->m.umInfo.ul.reOrdTmr = duRlcUeCfg->u.umBiDirCfg->ulUmCfg.reAssemTmr;
+
+            /* DL UM CONFIG */
+            rlcUeCfg->m.umInfo.dl.snLen = duRlcUeCfg->u.umBiDirCfg->dlUmCfg.snLenDlUm; 
+            break;
+         }
+      default:
+         break;
+   }/* End of switch(entMode) */
+}
+
+/*******************************************************************
+ *
+ * @brief fills LC Cfgs to be Added in RLC
+ *
+ * @details
+ *
+ *    Function : fillRlcCfg
+ *
+ *    Functionality:
+ *      fills LC Cfgs to be Add/Mod/Del in RLC
+ *
+ * @params[in] 
+ *             RlcEntCfgInfo pointer
+ *             RlcBearerCfg pointer
+ * @return void
+ *
+ ******************************************************************/
+
+void fillRlcCfg(RlcCfgInfo *rlcUeCfg, RlcUeCfg *ueCfg)
+{
+   uint8_t lcIdx;
+   
+   rlcUeCfg->ueId    = ueCfg->ueIdx;
+   rlcUeCfg->cellId  = ueCfg->cellId;
+   rlcUeCfg->numEnt  = ueCfg->numLcs;
+   rlcUeCfg->transId = getTransId();
+
+   for(lcIdx = 0; lcIdx < rlcUeCfg->numEnt; lcIdx++)
+   {
+      fillLcCfg(&rlcUeCfg->entCfg[lcIdx], &ueCfg->rlcLcCfg[lcIdx], ueCfg->rlcLcCfg[lcIdx].configType);
+   }
+}
+
 /*******************************************************************
  *
  * @brief Handles Ue Create Request from DU APP
  *
  * @details
  *
- *    Function : RlcUlProcUeCreateReq
+ *    Function : RlcProcUeCreateReq
  *
  *    Functionality:
  *      Handles Ue create Request from DU APP
@@ -141,80 +244,32 @@ void fillEntModeAndDir(uint8_t *entMode, uint8_t *direction, RlcMode rlcMode)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t RlcUlProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg)
+uint8_t RlcProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg)
 {
-   uint8_t idx;
    uint8_t ret = ROK;
-   uint8_t lChRbIdx;
    RlcCfgInfo *rlcUeCfg = NULLP;
 
    RlcCb *rlcUeCb = NULLP;
    rlcUeCb = RLC_GET_RLCCB(pst->dstInst);
    RLC_ALLOC(rlcUeCb, rlcUeCfg, sizeof(RlcCfgInfo));
-   if(rlcUeCfg)
+   if(rlcUeCfg == NULLP)
+   {
+      DU_LOG("\nRLC: Failed to allocate memory at RlcProcUeCreateReq()");
+      ret = RFAILED;
+   }
+   else
    {
       memset(rlcUeCfg, 0, sizeof(RlcCfgInfo));
-
-      rlcUeCfg->ueId    = ueCfg->ueIdx;
-      rlcUeCfg->cellId  = ueCfg->cellId;
-      rlcUeCfg->numEnt  = ueCfg->numLcs;
-      rlcUeCfg->transId = getTransId();
-      for(idx = 0; idx < ueCfg->numLcs; idx++)
-      {
-         lChRbIdx = 0;
-         rlcUeCfg->entCfg[idx].rbId           = ueCfg->rlcBearerCfg[idx].rbId;
-         rlcUeCfg->entCfg[idx].rbType         = ueCfg->rlcBearerCfg[idx].rbType;   // SRB or DRB
-         rlcUeCfg->entCfg[idx].lCh[lChRbIdx].lChId   = ueCfg->rlcBearerCfg[idx].lcId;   
-         rlcUeCfg->entCfg[idx].lCh[lChRbIdx].type    = ueCfg->rlcBearerCfg[idx].lcType;
-         fillEntModeAndDir(&rlcUeCfg->entCfg[idx].entMode, &rlcUeCfg->entCfg[idx].dir,\
-            ueCfg->rlcBearerCfg[idx].rlcMode);
-         rlcUeCfg->entCfg[idx].cfgType        = CKW_CFG_ADD;
-         switch(rlcUeCfg->entCfg[idx].entMode)
-         {
-
-            case CM_LTE_MODE_AM:
-            {
-               /* DL AM INFO */
-               rlcUeCfg->entCfg[idx].m.amInfo.dl.snLen = ueCfg->rlcBearerCfg[idx].u.amCfg.dlAmCfg.snLenDl; 
-               rlcUeCfg->entCfg[idx].m.amInfo.dl.pollRetxTmr = ueCfg->rlcBearerCfg[idx].u.amCfg.dlAmCfg.pollRetxTmr;
-               rlcUeCfg->entCfg[idx].m.amInfo.dl.pollPdu = ueCfg->rlcBearerCfg[idx].u.amCfg.dlAmCfg.pollPdu; 
-               rlcUeCfg->entCfg[idx].m.amInfo.dl.pollByte = ueCfg->rlcBearerCfg[idx].u.amCfg.dlAmCfg.pollByte; 
-               rlcUeCfg->entCfg[idx].m.amInfo.dl.maxRetx = ueCfg->rlcBearerCfg[idx].u.amCfg.dlAmCfg.maxRetxTh;
-
-               /* UL AM INFO */
-              lChRbIdx++;   //lChRbIdx = 1, indicates UL AM
-               rlcUeCfg->entCfg[idx].lCh[lChRbIdx].lChId   = ueCfg->rlcBearerCfg[idx].lcId;   
-               rlcUeCfg->entCfg[idx].lCh[lChRbIdx].type    = ueCfg->rlcBearerCfg[idx].lcType;
-               rlcUeCfg->entCfg[idx].m.amInfo.ul.snLen = ueCfg->rlcBearerCfg[idx].u.amCfg.ulAmCfg.snLenUl; 
-               rlcUeCfg->entCfg[idx].m.amInfo.ul.staProhTmr = ueCfg->rlcBearerCfg[idx].u.amCfg.ulAmCfg.statProhTmr;
-               rlcUeCfg->entCfg[idx].m.amInfo.ul.reOrdTmr = ueCfg->rlcBearerCfg[idx].u.amCfg.ulAmCfg.reAssemTmr;
-               break;
-            }
-            case CM_LTE_MODE_UM:
-            {
-               /* UL UM CONFIG */
-               rlcUeCfg->entCfg[idx].m.umInfo.ul.snLen = ueCfg->rlcBearerCfg[idx].u.umBiDirCfg.ulUmCfg.snLenUlUm; 
-               rlcUeCfg->entCfg[idx].m.umInfo.ul.reOrdTmr = ueCfg->rlcBearerCfg[idx].u.umBiDirCfg.ulUmCfg.reAssemTmr;
-
-               /* DL UM CONFIG */
-               rlcUeCfg->entCfg[idx].m.umInfo.dl.snLen = ueCfg->rlcBearerCfg[idx].u.umBiDirCfg.dlUmCfg.snLenDlUm; 
-               break;
-            }
-            default:
-               break;
-         }/* End of switch(entMode) */
-      }
+      fillRlcCfg(rlcUeCfg, ueCfg); 
       ret = RlcProcCfgReq(pst, rlcUeCfg);
-      }
-      else
-      {
-         DU_LOG("\nRLC: Failed to allocate memory ");
-         ret = RFAILED;
-      }
-      RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(RlcUeCfg));
-      return ret;
+      if(ret != ROK)
+         DU_LOG("\nRLC: Failed to configure Add/Mod/Del entities at RlcProcUeCreateReq()");
+
+   }
+   RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(RlcUeCfg));
+   return ret;
 }
+
 /*******************************************************************
 *
 * @brief filling the structure of rrc delivery msg info
@@ -565,6 +620,52 @@ uint8_t RlcProcSchedResultRpt(Pst *pst, RlcSchedResultRpt *schRep)
    return ret;
 }
 
+
+/*******************************************************************
+ *
+ * @brief Handles Ue Reconfig Request from DU APP
+ *
+ * @details
+ *
+ *    Function : RlcProcUeReconfigReq
+ *
+ *    Functionality:
+ *      Handles Ue Reconfig Request from DU APP
+ *
+ * @params[in] Post structure pointer
+ *             RlcUeCfg pointer 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t RlcProcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg)
+{
+   uint8_t ret = ROK;
+   RlcCfgInfo *rlcUeCfg = NULLP; //Seed code Rlc cfg struct
+   RlcCb *rlcUeCb = NULLP;
+    
+   DU_LOG("\nRLC: UE reconfig request received. CellID[%d] UEIDX[%d]",ueCfg->cellId, ueCfg->ueIdx);
+
+   rlcUeCb = RLC_GET_RLCCB(pst->dstInst);
+   RLC_ALLOC(rlcUeCb, rlcUeCfg, sizeof(RlcCfgInfo));
+   if(rlcUeCfg == NULLP)
+   {
+      DU_LOG("\nRLC: Failed to allocate memory at RlcProcUeReconfigReq()");
+      ret = RFAILED;
+   }
+   else
+   {
+      memset(rlcUeCfg, 0, sizeof(RlcCfgInfo));
+      fillRlcCfg(rlcUeCfg, ueCfg);
+      ret = RlcProcCfgReq(pst, rlcUeCfg);
+      if(ret != ROK)
+         DU_LOG("\nRLC: Failed to configure Add/Mod/Del entities at RlcProcUeReconfigReq()");
+   }
+   
+   RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(RlcUeCfg));
+   return ret;
+}
+
 /**********************************************************************
          End of file
 **********************************************************************/
index 9bfe6a3..b89b6f0 100644 (file)
@@ -463,7 +463,7 @@ void fillSchSib1Cfg(Inst schInst, SchSib1Cfg *sib1SchCfg, uint16_t pci, \
    sib1SchCfg->n0 = slotIndex;
 
    /* calculate the PRBs */
-   schAllocFreqDomRscType0(((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
+   freqDomRscAllocType0(((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
    /* fill BWP */
    bwp->freqAlloc.numPrb   = MAX_NUM_RB; /* whole of BW */
index d1e5bdb..e5ceaf3 100644 (file)
@@ -375,7 +375,7 @@ uint8_t schDlRsrcAllocMsg4(DlMsgAlloc *msg4Alloc, SchCellCb *cell, uint16_t slot
    }
 
    /* calculate the PRBs */
-   schAllocFreqDomRscType0(((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
+   freqDomRscAllocType0(((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
    /* fill BWP */
    bwp->freqAlloc.numPrb   = initialBwp->bwp.freqAlloc.numPrb;
index 477b6db..16bb970 100644 (file)
@@ -293,7 +293,7 @@ uint8_t schFillRar(RarAlloc *rarAlloc, uint16_t raRnti, uint16_t pci, uint8_t of
    }
 
    /* calculate the PRBs */
-   schAllocFreqDomRscType0(((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
+   freqDomRscAllocType0(((offsetPointA-offset)/6), (numRbs/6), FreqDomainResource);
 
    /* fill BWP */
    bwp->freqAlloc.numPrb   = initialBwp->bwp.freqAlloc.numPrb;
index b78ea4d..d5b93fb 100644 (file)
@@ -68,7 +68,7 @@ void SchSendUeCfgRspToMac(SchUeCfg *ueCfg, Inst inst,\
    /* Filling response post */
    memset(&rspPst, 0, sizeof(Pst));
    FILL_PST_SCH_TO_MAC(rspPst, inst);
-   rspPst.event = EVENT_UE_CREATE_RSP_TO_MAC;
+   rspPst.event = EVENT_UE_CONFIG_RSP_TO_MAC;
 
    SchUeCfgRspOpts[rspPst.selector](&rspPst, cfgRsp);
 }
@@ -159,11 +159,6 @@ uint8_t MacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfg)
        ueCb->dlLcCtxt[lcId].lcState = SCH_LC_STATE_ACTIVE;
        ueCb->dlLcCtxt[lcId].bo = 0;
        ueCb->numDlLc++;
-       
-       if(ueCfg->lcCfgList[lcIdx].ulLcCfg)
-       {
-          /* TODO : Fill UL LC Cfg. As of now for SRB1, it is null */
-       }
    }
 
    cellCb->numActvUe++;
@@ -335,6 +330,26 @@ uint8_t schFillUlDci(SchUeCb *ueCb, SchPuschInfo puschInfo, DciInfo *dciInfo)
 }
 
 
+/*******************************************************************
+ *
+ * @brief Hanles Ue Reconfig request from MAC
+ *
+ * @details
+ *
+ *    Function : MacSchUeReconfigReq
+ *
+ *    Functionality: Hanles Ue Reconfig request from MAC
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t MacSchUeReconfigReq(Pst *pst, SchUeCfg *ueCfg)
+{
+   //TODO:
+   return ROK;
+}
 /**********************************************************************
   End of file
  **********************************************************************/
index 310aeb3..d0fc85f 100644 (file)
@@ -86,7 +86,7 @@ extern int8_t coresetIdxTable[MAX_CORESET_INDEX][4];
 extern int8_t searchSpaceIdxTable[MAX_SEARCH_SPACE_INDEX][4];
 
 /* functions declarations */
-void schAllocFreqDomRscType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain);
+void freqDomRscAllocType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain);
 uint16_t schCalcTbSize(uint16_t payLoadSize);
 uint16_t schCalcNumPrb(uint16_t tbSize, uint16_t mcs, uint8_t numSymbols);
 uint16_t schCalcTbSizeFromNPrb(uint16_t numPrb, uint16_t mcs, uint8_t numSymbols);
index 70c35ad..867a9c4 100644 (file)
@@ -23,7 +23,7 @@
  *
  * @details
  *
- *     Function: schAllocFreqDomRscType0
+ *     Function: freqDomRscAllocType0
  *     
  *     This function does allocation in frequency domain resource.
  *     This is a bitmap defining  non-overlapping groups of 6 PRBs in ascending order.
@@ -33,7 +33,7 @@
  *  @param[in]  freqDomain - 6 bytes of info, each bit represents a group of 6 PRB.
  *  @return   void
  **/
-void schAllocFreqDomRscType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain)
+void freqDomRscAllocType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain)
 {
    uint8_t remBits = prbSize; /* each bit represents 6 PRBs */
    uint8_t firstByte = 1;
@@ -108,7 +108,6 @@ void oduCpyFixBufToMsg(uint8_t *fixBuf, Buffer *mBuf, uint16_t len)
 }
 
 
-
 /**********************************************************************
          End of file
 **********************************************************************/
index 34dfd20..9f4fc7c 100644 (file)
@@ -76,7 +76,7 @@
 #define SRB2_LCID  2
 #define SRB3_LCID  3
 #define MIN_DRB_LCID 4
-#define MAX_DRB_LCID 10
+#define MAX_DRB_LCID 32
 
 #define FREQ_DOM_RSRC_SIZE  6      /* i.e. 6 bytes because Size of frequency domain resource is 45 bits */
 
@@ -163,7 +163,22 @@ typedef struct PlmnIdentity
    uint8_t mnc[3];
 }Plmn;
 
-void schAllocFreqDomRscType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain);
+typedef enum
+{
+   UE_CFG_INACTIVE,
+   UE_CONFIG_COMPLETE,
+   UE_RECFG_COMPLETE
+}UeCfgState;
+
+typedef enum
+{
+   CONFIG_UNKNOWN,
+   CONFIG_ADD,
+   CONFIG_MOD,
+   CONFIG_DEL
+}ConfigType;
+
+void freqDomRscAllocType0(uint16_t startPrb, uint16_t prbSize, uint8_t *freqDomain);
 void oduCpyFixBufToMsg(uint8_t *fixBuf, Buffer *mBuf, uint16_t len);
 
 #endif
index 68379e4..84625f1 100644 (file)
@@ -769,7 +769,7 @@ uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf)
  *
  * @details
  *
- *    Function : packDuMacUeCreateRsp
+ *    Function : packDuMacUeCfgRsp
  *
  *    Functionality:
  *       Pack and send UE config response from MAC to DU APP
@@ -779,7 +779,7 @@ uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t packDuMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
+uint8_t packDuMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
 {
    Buffer *mBuf = NULLP;
 
@@ -808,7 +808,7 @@ uint8_t packDuMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
  *
  * @details
  *
- *    Function : unpackDuMacUeCreateRsp
+ *    Function : unpackDuMacUeCfgRsp
  *
  *    Functionality: Unpack UE Config Response from MAC to DU APP
  *
@@ -817,7 +817,7 @@ uint8_t packDuMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t unpackDuMacUeCreateRsp(DuMacUeCreateRspFunc func, Pst *pst, Buffer *mBuf)
+uint8_t unpackDuMacUeCfgRsp(MacDuUeCfgRspFunc func, Pst *pst, Buffer *mBuf)
 {
    if(pst->selector == ODU_SELECTOR_LWLC)
    {
@@ -833,6 +833,85 @@ uint8_t unpackDuMacUeCreateRsp(DuMacUeCreateRspFunc func, Pst *pst, Buffer *mBuf
    return RFAILED;
 }
 
+/*******************************************************************
+ *
+ * @brief Packs and Sends UE Reconig Request from DUAPP to MAC
+ *
+ * @details
+ *
+ *    Function : packDuMacUeReconfigReq
+ *
+ *    Functionality:
+ *       Packs and Sends UE Reconfig Request from DUAPP to MAC
+ *
+ *
+ * @params[in] Post structure pointer
+ *             MacUeCfg pointer              
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeCfg *ueCfg)
+{
+   Buffer *mBuf = NULLP;
+
+   if(pst->selector == ODU_SELECTOR_LWLC)
+   {
+      if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
+      {
+        DU_LOG("\nMAC : Memory allocation failed at packDuMacUeReconfigReq");
+        return RFAILED;
+      }
+      /* pack the address of the structure */
+      CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
+   }
+   else
+   {
+      DU_LOG("\nMAC: Only LWLC supported for packDuMacUeReconfigReq");
+      return RFAILED;
+   }
+
+   return ODU_POST_TASK(pst,mBuf);
+}
+/*******************************************************************
+ *
+ * @brief Unpacks UE Reconfig Request received from DU APP
+ *
+ * @details
+ *
+ *    Function : unpackMacUeReconfigReq
+ *
+ *    Functionality:
+ *         Unpacks UE Reconfig Request received from DU APP
+ *
+ * @params[in] Pointer to Handler
+ *             Post structure pointer
+ *             Message Buffer
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf)
+{
+   if(pst->selector == ODU_SELECTOR_LWLC)
+   {
+      MacUeCfg *ueCfg;
+
+      /* unpack the address of the structure */
+      CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf);
+      ODU_PUT_MSG_BUF(mBuf);
+      return (*func)(pst, ueCfg);
+   }
+   else
+   {
+      /* Nothing to do for other selectors */
+      DU_LOG("\n Only LWLC supported for UE Create Request ");
+      ODU_PUT_MSG_BUF(mBuf);
+   }
+
+   return RFAILED;
+}
+
 /**********************************************************************
   End of file
  **********************************************************************/
index 237f4d1..6d30e3e 100644 (file)
 #define EVENT_MAC_STOP_IND           205
 #define EVENT_MAC_UL_CCCH_IND        206
 #define EVENT_MAC_DL_CCCH_IND        207
-#define EVENT_MAC_UE_CREATE_REQ      208
-#define EVENT_MAC_UE_CREATE_RSP      209
+#define EVENT_MAC_UE_CONFIG_REQ      208
+#define EVENT_MAC_UE_CONFIG_RSP      209
+#define EVENT_MAC_UE_RECONFIG_REQ    210
+#define EVENT_MAC_UE_RECONFIG_RSP    211
 
 typedef enum
 {
@@ -188,6 +190,57 @@ typedef enum
    TIME_ALIGNMENT_TIMER_INFINITY
 }TimeAlignmentTimer;
 
+typedef enum
+{
+   BSR_PERIODIC_TIMER_SF_1,
+   BSR_PERIODIC_TIMER_SF_5,
+   BSR_PERIODIC_TIMER_SF_10,
+   BSR_PERIODIC_TIMER_SF_16,
+   BSR_PERIODIC_TIMER_SF_20,
+   BSR_PERIODIC_TIMER_SF_32,
+   BSR_PERIODIC_TIMER_SF_40,
+   BSR_PERIODIC_TIMER_SF_64,
+   BSR_PERIODIC_TIMER_SF_80,
+   BSR_PERIODIC_TIMER_SF_128,
+   BSR_PERIODIC_TIMER_SF_160,
+   BSR_PERIODIC_TIMER_SF_320,
+   BSR_PERIODIC_TIMER_SF_640,
+   BSR_PERIODIC_TIMER_SF_1280,
+   BSR_PERIODIC_TIMER_SF_2560,
+   BSR_PERIODIC_TIMER_INFINITY
+}BsrPeriodicTimer;
+
+typedef enum
+{
+   BSR_RETX_TIMER_SF_10,
+   BSR_RETX_TIMER_SF_20,
+   BSR_RETX_TIMER_SF_40,
+   BSR_RETX_TIMER_SF_80,
+   BSR_RETX_TIMER_SF_160,
+   BSR_RETX_TIMER_SF_320,
+   BSR_RETX_TIMER_SF_640,
+   BSR_RETX_TIMER_SF_1280,
+   BSR_RETX_TIMER_SF_2560,
+   BSR_RETX_TIMER_SF_5120,
+   BSR_RETX_TIMER_SF_10240,
+   BSR_RETX_TIMER_SPARE_5,
+   BSR_RETX_TIMER_SPARE_4,
+   BSR_RETX_TIMER_SPARE_3,
+   BSR_RETX_TIMER_SPARE_2,
+   BSR_RETX_TIMER_SPARE_1
+}BsrReTxTimer;
+
+typedef enum
+{
+   BSR_SR_DELAY_TMR_20,
+   BSR_SR_DELAY_TMR_40,
+   BSR_SR_DELAY_TMR_64,
+   BSR_SR_DELAY_TMR_128,
+   BSR_SR_DELAY_TMR_512,
+   BSR_SR_DELAY_TMR_1024,
+   BSR_SR_DELAY_TMR_2560,
+   BSR_SR_DELAY_TMR_SPARE_1
+}BsrSrDelayTimer;
 typedef enum
 {
    PHR_PERIODIC_TIMER_SF_10,
@@ -264,13 +317,13 @@ typedef enum
 
 typedef enum 
 {
-   CCE_REG_MAPPINGTYPE_PR_INTERLEAVED,
+   CCE_REG_MAPPINGTYPE_PR_INTERLEAVED = 1,
    CCE_REG_MAPPINGTYPE_PR_NONINTERLEAVED
 }REGMappingType;
 
 typedef enum
 {
-   SLOTPERIODICITYANDOFFSET_PR_SL1,
+   SLOTPERIODICITYANDOFFSET_PR_SL1 = 1,
    SLOTPERIODICITYANDOFFSET_PR_SL2,
    SLOTPERIODICITYANDOFFSET_PR_SL4,
    SLOTPERIODICITYANDOFFSET_PR_SL5,
@@ -295,10 +348,16 @@ typedef enum
 
 typedef enum
 {
-   SEARCHSPACETYPE_PR_COMMON,
+   SEARCHSPACETYPE_PR_COMMON = 1,
    SEARCHSPACETYPE_PR_UE_SPECIFIC
 }SearchSpaceType;
 
+typedef enum
+{
+   QOS_NON_DYNAMIC = 1,
+   QOS_DYNAMIC
+}QosType;
+
 typedef enum
 {
    AGGREGATIONLEVEL_N0 = 0,  
@@ -345,10 +404,24 @@ typedef enum
 
 typedef enum
 {
-   TYPE_STATIC_BUNDLING,
+   TYPE_STATIC_BUNDLING = 1,
    TYPE_DYNAMIC_BUNDLING
 }BundlingType;
 
+typedef enum
+{
+   SET2_SIZE_N4,
+   SET2_SIZE_WIDEBAND
+}BundlingSizeSet2;
+
+typedef enum
+{
+   SET1_SIZE_N4,
+   SET1_SIZE_WIDEBAND,
+   SET1_SIZE_N2_WIDEBAND,
+   SET1_SIZE_N4_WIDEBAND
+}BundlingSizeSet1;
+
 typedef enum
 {
    LC_PRIORITY_1 = 1,
@@ -356,6 +429,47 @@ typedef enum
    LC_PRIORITY_3
 }LcPriority;
 
+typedef enum
+{
+  PBR_KBPS_0,
+  PBR_KBPS_8,
+  PBR_KBPS_16,
+  PBR_KBPS_32,
+  PBR_KBPS_64,
+  PBR_KBPS_128,
+  PBR_KBPS_256,
+  PBR_KBPS_512,
+  PBR_KBPS_1024,
+  PBR_KBPS_2048,
+  PBR_KBPS_4096,
+  PBR_KBPS_8192,
+  PBR_KBPS_16384,
+  PBR_KBPS_32768,
+  PBR_KBPS_65536,
+  PBR_KBPS_INFINITY
+}PBitRate;
+
+typedef enum
+{
+   BSD_MS_5,
+   BSD_MS_10,
+   BSD_MS_20,
+   BSD_MS_50,
+   BSD_MS_100,
+   BSD_MS_150,
+   BSD_MS_300,
+   BSD_MS_500,
+   BSD_MS_1000,
+   BSD_SPARE_7,
+   BSD_SPARE_6,
+   BSD_SPARE_5,
+   BSD_SPARE_4,
+   BSD_SPARE_3,
+   BSD_SPARE_2,
+   BSD_SPARE_1
+
+}BucketSizeDur;
+
 typedef enum
 {
    RADIO_NW_LAYER_FAIL,
@@ -625,9 +739,9 @@ typedef struct dlCcchInd
 
 typedef struct bsrTmrCfg
 {
-   uint8_t periodicTimer;
-   uint8_t retxTimer;
-   uint8_t srDelayTimer;
+   BsrPeriodicTimer periodicTimer;
+   BsrReTxTimer retxTimer;
+   BsrSrDelayTimer srDelayTimer;
 }BsrTmrCfg;
 
 
@@ -737,6 +851,20 @@ typedef struct pdschTimeDomRsrcAlloc
    uint8_t           startSymbolAndLength;
 }PdschTimeDomRsrcAlloc;
 
+
+typedef struct pdschBundling
+{
+   struct staticBundling
+   {
+     BundlingSizeSet2 size;
+   }StaticBundling;
+   struct dynamicBundling
+   {
+     BundlingSizeSet1 sizeSet1;
+     BundlingSizeSet2 sizeSet2;
+   }DynamicBundling;
+}PdschBundling;
+
 /* DMRS downlink configuration */
 typedef struct dmrsDlCfg
 {
@@ -753,6 +881,7 @@ typedef struct pdschConfig
    RBGSize                 rbgSize;
    CodeWordsSchedDci       numCodeWordsSchByDci;                    /* Number of code words scheduled by DCI */
    BundlingType            bundlingType;
+   PdschBundling           bundlingInfo;
 }PdschConfig;
 
 /* Initial Downlink BWP */
@@ -817,6 +946,7 @@ typedef struct puschTimeDomRsrcAlloc
 /* PUSCH Configuration */
 typedef struct puschCfg
 {
+   uint8_t                 dataScramblingId;
    DmrsUlCfg               dmrsUlCfgForPuschMapTypeA;
    ResAllocType            resourceAllocType;
    uint8_t                 numTimeDomRsrcAlloc;
@@ -912,7 +1042,7 @@ typedef struct grbQosInfo
 
 typedef struct drbQos
 {
-   uint8_t  fiveQiType;   /* Dynamic or non-dynamic */ 
+   QosType  fiveQiType;   /* Dynamic or non-dynamic */ 
    union
    {
       NonDynFiveQi   nonDyn5Qi;
@@ -929,8 +1059,8 @@ typedef struct ulLcCfg
    uint8_t priority;
    uint8_t lcGroup;
    uint8_t schReqId;
-   uint8_t pbr;        // prioritisedBitRate
-   uint8_t bsd;        // bucketSizeDuration
+   PBitRate pbr;        // prioritisedBitRate
+   BucketSizeDur bsd;        // bucketSizeDuration
 }UlLcCfg;
 
 typedef struct duLcCfg
@@ -940,12 +1070,13 @@ typedef struct duLcCfg
 
 typedef struct lcCfg
 {
+   ConfigType configType;
    uint8_t lcId;
    DrbQosInfo *drbQos; 
    Snssai  *snssai;
-   UlLcCfg *ulLcCfg;
+   bool ulLcCfgPres;
+   UlLcCfg ulLcCfg;
    DlLcCfg dlLcCfg;
-
 }LcCfg;
 
 typedef struct macUeCfg
@@ -959,6 +1090,7 @@ typedef struct macUeCfg
    MaxAggrBitRate *maxAggrBitRate;
    uint8_t numLcs;
    LcCfg lcCfgList[MAX_NUM_LC];
+   UeCfgState macUeCfgState; /* InActive / Completed */
 }MacUeCfg;
 
 typedef struct nrcgi
@@ -1051,10 +1183,15 @@ typedef uint8_t (*DuMacUeCreateReq) ARGS((
         MacUeCfg      *ueCfg ));
 
 /* UE create Response from MAC to DU APP */
-typedef uint8_t (*DuMacUeCreateRspFunc) ARGS((
+typedef uint8_t (*MacDuUeCfgRspFunc) ARGS((
         Pst           *pst, 
         MacUeCfgRsp   *cfgRsp));
 
+/* UE Reconfig Request from DU APP to MAC*/
+typedef uint8_t (*DuMacUeReconfigReq) ARGS((
+        Pst           *pst,
+        MacUeCfg      *ueCfg ));
+
 uint8_t packMacSlotInd(Pst *pst, SlotIndInfo *slotInfo );
 uint8_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf);
 uint8_t duHandleSlotInd(Pst *pst, SlotIndInfo *slotInfo);
@@ -1082,10 +1219,14 @@ uint8_t MacProcDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
 uint8_t packDuMacUeCreateReq(Pst *pst, MacUeCfg *ueCfg);
 uint8_t unpackMacUeCreateReq(DuMacUeCreateReq func, Pst *pst, Buffer *mBuf);
 uint8_t MacProcUeCreateReq(Pst *pst, MacUeCfg *ueCfg);
-uint8_t packDuMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp);
-uint8_t unpackDuMacUeCreateRsp(DuMacUeCreateRspFunc func, Pst *pst, Buffer *mBuf);
-uint8_t DuHandleMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp);
 uint8_t sendStopIndMacToDuApp(uint16_t cellId);
+uint8_t packDuMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp);
+uint8_t unpackDuMacUeCfgRsp(MacDuUeCfgRspFunc func, Pst *pst, Buffer *mBuf);
+uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp);
+uint8_t packDuMacUeReconfigReq(Pst *pst, MacUeCfg *ueCfg);
+uint8_t unpackMacUeReconfigReq(DuMacUeReconfigReq func, Pst *pst, Buffer *mBuf);
+uint8_t MacProcUeReconfigReq(Pst *pst, MacUeCfg *ueCfg);
+
 #endif
 
 /**********************************************************************
index 85a1699..41e1c0b 100644 (file)
@@ -25,7 +25,7 @@
  *
  * @details
  *
- *    Function : packDuRlcUlUeCreateReq
+ *    Function : packDuRlcUeCreateReq
  *
  *    Functionality:
  *       Packs and Sends UE Create Request from DUAPP to RLC
@@ -37,7 +37,7 @@
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t packDuRlcUlUeCreateReq(Pst *pst, RlcUeCfg *ueCfg)
+uint8_t packDuRlcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg)
 {
    Buffer *mBuf = NULLP;
  
@@ -66,7 +66,7 @@ uint8_t packDuRlcUlUeCreateReq(Pst *pst, RlcUeCfg *ueCfg)
  *
  * @details
  *
- *    Function : unpackRlcUlUeCreateReq
+ *    Function : unpackRlcUeCreateReq
  *
  *    Functionality:
  *         Unpacks UE Create Request received from DU APP
@@ -78,7 +78,7 @@ uint8_t packDuRlcUlUeCreateReq(Pst *pst, RlcUeCfg *ueCfg)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t unpackRlcUlUeCreateReq(DuRlcUlUeCreateReq func, Pst *pst, Buffer *mBuf)
+uint8_t unpackRlcUeCreateReq(DuRlcUeCreateReq func, Pst *pst, Buffer *mBuf)
 {
    if(pst->selector == ODU_SELECTOR_LWLC)
    {
@@ -100,14 +100,14 @@ uint8_t unpackRlcUlUeCreateReq(DuRlcUlUeCreateReq func, Pst *pst, Buffer *mBuf)
 
 /*******************************************************************
  *
- * @brief Packs and Sends UE create Response from RLC to DUAPP
+ * @brief Packs and Sends UE Cfg Response from RLC to DUAPP
  *
  * @details
  *
- *    Function : packRlcUlDuUeCreateRsp
+ *    Function : packRlcDuUeCfgRsp
  *
  *    Functionality:
- *       Packs and Sends UE Create Rrsponse from RLC to DUAPP
+ *       Packs and Sends UE Cfg Rrsponse from RLC to DUAPP
  *
  *
  * @params[in] Post structure pointer
@@ -116,7 +116,7 @@ uint8_t unpackRlcUlUeCreateReq(DuRlcUlUeCreateReq func, Pst *pst, Buffer *mBuf)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t packRlcUlDuUeCreateRsp(Pst *pst, RlcUeCfgRsp *ueCfg)
+uint8_t packRlcDuUeCfgRsp(Pst *pst, RlcUeCfgRsp *ueCfg)
 {
    Buffer *mBuf = NULLP;
  
@@ -124,7 +124,7 @@ uint8_t packRlcUlDuUeCreateRsp(Pst *pst, RlcUeCfgRsp *ueCfg)
    {
       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
       {
-         DU_LOG("\nRLC : Memory allocation failed at packRlcUlDuUeCreateRsp");
+         DU_LOG("\nRLC : Memory allocation failed at packRlcDuUeCfgRsp");
          return RFAILED;
       }
       /* pack the address of the structure */
@@ -132,7 +132,7 @@ uint8_t packRlcUlDuUeCreateRsp(Pst *pst, RlcUeCfgRsp *ueCfg)
    }
    else
    {
-      DU_LOG("\nRLC: Only LWLC supported for packRlcUlDuUeCreateRsp");
+      DU_LOG("\nRLC: Only LWLC supported for packRlcDuUeCfgRsp");
       return RFAILED;
    }
 
@@ -141,14 +141,14 @@ uint8_t packRlcUlDuUeCreateRsp(Pst *pst, RlcUeCfgRsp *ueCfg)
 
 /*******************************************************************
  *
- * @brief Unpacks UE Create Response received from DU APP
+ * @brief Unpacks UE Cfg Response received from DU APP
  *
  * @details
  *
- *    Function : unpackRlcUlUeCreateRsp
+ *    Function : unpackRlcUeCfgRsp
  *
  *    Functionality:
- *         Unpacks UE Create Response received from DU APP
+ *         Unpacks UE Cfg Response received from DU APP
  *
  * @params[in] Pointer to Handler
  *             Post structure pointer
@@ -157,7 +157,7 @@ uint8_t packRlcUlDuUeCreateRsp(Pst *pst, RlcUeCfgRsp *ueCfg)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t unpackRlcUlUeCreateRsp(RlcUlDuUeCreateRsp func, Pst *pst, Buffer *mBuf)
+uint8_t unpackRlcUeCfgRsp(RlcDuUeCfgRsp func, Pst *pst, Buffer *mBuf)
 {
    if(pst->selector == ODU_SELECTOR_LWLC)
    {
@@ -170,7 +170,7 @@ uint8_t unpackRlcUlUeCreateRsp(RlcUlDuUeCreateRsp func, Pst *pst, Buffer *mBuf)
    else
    {
       /* Nothing to do for other selectors */
-      DU_LOG("\nRLC: Only LWLC supported for UE Create Response ");
+      DU_LOG("\nRLC: Only LWLC supported for UE Cfg Response ");
       ODU_PUT_MSG_BUF(mBuf);
    }
 
@@ -276,7 +276,7 @@ uint8_t packDlRrcMsgToRlc(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo)
    {
       if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
       {
-         DU_LOG("\nRLC : Memory allocation failed at packRlcUlRrcMsgToDu");
+         DU_LOG("\nRLC : Memory allocation failed at packRlcDlRrcMsgToRlc");
          return RFAILED;
       }
       /* pack the address of the structure */
@@ -405,6 +405,83 @@ uint8_t unpackRrcDeliveryReportToDu(RlcRrcDeliveryReportToDuFunc func, Pst *pst,
     return RFAILED;
 }
 
+/*******************************************************************
+ *
+ * @brief Packs and Sends UE Reconfig Request from DUAPP to RLC
+ *
+ * @details
+ *
+ *    Function : packDuRlcUeReconfigReq
+ *
+ *    Functionality:
+ *       Packs and Sends UE Reconfig Request from DUAPP to RLC
+ *
+ *
+ * @params[in] Post structure pointer
+ *             RlcUeCfg pointer              
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t packDuRlcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg)
+{
+   Buffer *mBuf = NULLP;
+   if(pst->selector == ODU_SELECTOR_LWLC)
+   {
+      if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK)
+      {
+         DU_LOG("\nRLC : Memory allocation failed at packDuRlcUeReconfigReq");
+         return RFAILED;
+      }
+      /* pack the address of the structure */
+      CMCHKPK(oduPackPointer,(PTR)ueCfg, mBuf);
+   }
+   else
+   {
+      DU_LOG("\nRLC: Only LWLC supported for packDuRlcUeReconfigReq");
+      return RFAILED;
+   }
+
+    return ODU_POST_TASK(pst,mBuf);
+}
+
+/*******************************************************************
+ * @brief Unpacks UE Reconfig Request received from DU APP
+ *
+ * @details
+ *
+ *    Function : unpackRlcUeReconfigReq
+ *
+ *    Functionality:
+ *         Unpacks UE Create Request received from DU APP
+ *
+ * @params[in] Pointer to Handler
+ *             Post structure pointer
+ *             Message Buffer
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t unpackRlcUeReconfigReq(DuRlcUeReconfigReq func, Pst *pst, Buffer *mBuf)
+{
+   if(pst->selector == ODU_SELECTOR_LWLC)
+   {
+      RlcUeCfg *ueCfg;
+      /* unpack the address of the structure */
+      CMCHKUNPK(oduUnpackPointer, (PTR *)&ueCfg, mBuf);
+      ODU_PUT_MSG_BUF(mBuf);
+      return (*func)(pst, ueCfg);
+   }
+   else
+   {
+      /* Nothing to do for other selectors */
+      DU_LOG("\nRLC: Only LWLC supported for UE Create Request ");
+      ODU_PUT_MSG_BUF(mBuf);
+   }
+   return RFAILED;
+}
+
 /**********************************************************************
          End of file
 ***********************************************************************/
index 6999587..41f99c5 100644 (file)
 #define __RLC_INF_H__
 
 /* Events */
-#define EVENT_RLC_UL_UE_CREATE_REQ  210
-#define EVENT_RLC_UL_UE_CREATE_RSP 211    /*!< Config Confirm */
+#define EVENT_RLC_UE_CONFIG_REQ  210
+#define EVENT_RLC_UE_CONFIG_RSP 211    /*!< Config Confirm */
 #define EVENT_UL_RRC_MSG_TRANS_TO_DU  212
 #define EVENT_DL_RRC_MSG_TRANS_TO_RLC 213
 #define EVENT_RRC_DELIVERY_MSG_TRANS_TO_DU 214
+#define EVENT_RLC_UE_RECONFIG_REQ  215
+#define EVENT_RLC_UE_RECONFIG_RSP  216
 
 #define RB_ID_SRB 0
 #define RB_ID_DRB 1
@@ -461,6 +463,7 @@ typedef struct umUniDirDlBearerCfg
 /* Spec Ref: 38.331, 6.3.2 RLC-BearerConfig */
 typedef struct rlcBearerCfg
 {
+   ConfigType   configType;
    uint8_t      rbId;
    uint8_t      rbType;
    uint8_t      lcId;
@@ -468,10 +471,10 @@ typedef struct rlcBearerCfg
    RlcMode      rlcMode;
    union
    {
-      AmBearerCfg         amCfg;
-      UmBiDirBearerCfg    umBiDirCfg;
-      UmUniDirUlBearerCfg umUniDirUlCfg;
-      UmUniDirDlBearerCfg umUniDirDlCfg;
+      AmBearerCfg         *amCfg;
+      UmBiDirBearerCfg    *umBiDirCfg;
+      UmUniDirUlBearerCfg *umUniDirUlCfg;
+      UmUniDirDlBearerCfg *umUniDirDlCfg;
    }u;
 }RlcBearerCfg;
 
@@ -480,7 +483,8 @@ typedef struct rlcUeCfg
    uint16_t     cellId;
    uint8_t      ueIdx;
    uint8_t      numLcs;
-   RlcBearerCfg rlcBearerCfg[MAX_NUM_LC];
+   RlcBearerCfg rlcLcCfg[MAX_NUM_LC];
+   UeCfgState rlcUeCfgState; /* InActive / Completed */
 }RlcUeCfg;
 
 typedef struct rlcUeCfgRsp
@@ -533,12 +537,12 @@ typedef struct rrcDeliveryReportInfo
 
 /* Function Pointers */
 /* UE create Request from DU APP to RLC*/
-typedef uint8_t (*DuRlcUlUeCreateReq) ARGS((
+typedef uint8_t (*DuRlcUeCreateReq) ARGS((
    Pst           *pst,
    RlcUeCfg      *ueCfg ));
 
-/* UE create Response from RLC to DU APP*/
-typedef uint8_t (*RlcUlDuUeCreateRsp) ARGS((
+/* UE Cfg Response from RLC to DU APP*/
+typedef uint8_t (*RlcDuUeCfgRsp) ARGS((
    Pst          *pst,
    RlcUeCfgRsp  *ueCfgRsp));
 
@@ -557,24 +561,32 @@ typedef uint8_t (*RlcRrcDeliveryReportToDuFunc) ARGS((
    Pst           *pst,
    RrcDeliveryReport *rrcDeliveryReport));
 
+typedef uint8_t (*DuRlcUeReconfigReq) ARGS((
+   Pst           *pst,
+   RlcUeCfg      *ueCfg ));
+
 /* Pack/Unpack function declarations */
-uint8_t packDuRlcUlUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
-uint8_t unpackRlcUlUeCreateReq(DuRlcUlUeCreateReq func, Pst *pst, Buffer *mBuf);
-uint8_t packRlcUlDuUeCreateRsp(Pst *pst, RlcUeCfgRsp *ueCfgRsp);
-uint8_t unpackRlcUlUeCreateRsp(RlcUlDuUeCreateRsp func, Pst *pst, Buffer *mBuf);
+uint8_t packDuRlcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
+uint8_t unpackRlcUeCreateReq(DuRlcUeCreateReq func, Pst *pst, Buffer *mBuf);
+uint8_t packRlcDuUeCfgRsp(Pst *pst, RlcUeCfgRsp *ueCfgRsp);
+uint8_t unpackRlcUeCfgRsp(RlcDuUeCfgRsp func, Pst *pst, Buffer *mBuf);
 uint8_t packRlcUlRrcMsgToDu(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo);
 uint8_t unpackRlcUlRrcMsgToDu(RlcUlRrcMsgToDuFunc func, Pst *pst, Buffer *mBuf);
 uint8_t packDlRrcMsgToRlc(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo);
 uint8_t unpackDlRrcMsgToRlc(DuDlRrcMsgToRlcFunc func, Pst *pst, Buffer *mBuf);
 uint8_t packRrcDeliveryReportToDu(Pst *pst, RrcDeliveryReport *rrcDeliveryReport);
 uint8_t unpackRrcDeliveryReportToDu(RlcRrcDeliveryReportToDuFunc func,Pst *pst, Buffer *mBuf);
+uint8_t packDuRlcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg);
+uint8_t unpackRlcUeReconfigReq(DuRlcUeReconfigReq func, Pst *pst, Buffer *mBuf);
 
 /* Event Handler function declarations */
-uint8_t RlcUlProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
-uint8_t DuProcRlcUlUeCreateRsp(Pst *pst, RlcUeCfgRsp *cfgRsp);
+uint8_t RlcProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg);
+uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp);
 uint8_t DuProcRlcUlRrcMsgTrans(Pst *pst, RlcUlRrcMsgInfo *ulRrcMsgInfo);
 uint8_t RlcProcDlRrcMsgTransfer(Pst *pst, RlcDlRrcMsgInfo *dlRrcMsgInfo);
 uint8_t DuProcRlcRrcDeliveryReport(Pst *pst, RrcDeliveryReport *rrcDeliveryReport);
+uint8_t RlcProcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg);
+
 #endif /* RLC_INF_H */
 
 /**********************************************************************
index 3dab44f..14417cd 100644 (file)
@@ -327,7 +327,34 @@ uint8_t packMacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd)
    return ROK;
 }
 
-
+/*******************************************************************
+ *
+ * @brief Pack and Send UE Reconfig Request from MAC to SCH
+ *
+ * @details
+ *
+ *    Function : packMacSchUeReconfigReq
+ *
+ *    Functionality:
+ *       Pack and Send UE Reconfig Request from MAC to SCH
+ *
+ * @params[in]
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t packMacSchUeReconfigReq(Pst *pst, SchUeCfg  *ueCfg)
+{
+   if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LC))
+   {
+      /* TODO */
+   }
+   else
+   {
+      return RFAILED; 
+   }
+   return ROK;
+}
 
 /**********************************************************************
   End of file
index 0b82447..2783f0e 100644 (file)
 #define EVENT_RACH_IND_TO_SCH        5
 #define EVENT_CRC_IND_TO_SCH         6
 #define EVENT_DL_RLC_BO_INFO_TO_SCH  7
-#define EVENT_UE_CREATE_REQ_TO_SCH   8
-#define EVENT_UE_CREATE_RSP_TO_MAC   9
+#define EVENT_UE_CONFIG_REQ_TO_SCH   8
+#define EVENT_UE_CONFIG_RSP_TO_MAC   9
 #define EVENT_SLOT_IND_TO_SCH        10
 #define EVENT_SHORT_BSR              11
 #define EVENT_UCI_IND_TO_SCH         12
+#define EVENT_UE_RECONFIG_REQ_TO_SCH 13
+#define EVENT_UE_RECONFIG_RSP_TO_MAC 14
+
 
 /*macros*/
 #define NO_SSB 0
@@ -230,13 +233,13 @@ typedef enum
 
 typedef enum
 {
-   INTERLEAVED_CCE_REG_MAPPING,
+   INTERLEAVED_CCE_REG_MAPPING = 1,
    NONINTERLEAVED_CCE_REG_MAPPING
 }SchREGMappingType;
 
 typedef enum
 {
-   SLOT_PERIODICITY_AND_OFFSET_SL_1,
+   SLOT_PERIODICITY_AND_OFFSET_SL_1 = 1,
    SLOT_PERIODICITY_AND_OFFSET_SL_2,
    SLOT_PERIODICITY_AND_OFFSET_SL_4,
    SLOT_PERIODICITY_AND_OFFSET_SL_5,
@@ -261,10 +264,16 @@ typedef enum
 
 typedef enum
 {
-   SEARCH_SPACE_TYPE_COMMON,
+   SEARCH_SPACE_TYPE_COMMON = 1,
    SEARCH_SPACE_TYPE_UE_SPECIFIC
 }SchSearchSpaceType;
 
+typedef enum
+{
+   SCH_QOS_NON_DYNAMIC = 1,
+   SCH_QOS_DYNAMIC
+}SchQosType;
+
 typedef enum
 {
    AGGREGATION_LEVEL_N0,
@@ -291,10 +300,24 @@ typedef enum
 
 typedef enum
 {
-   STATIC_BUNDLING_TYPE,
+   STATIC_BUNDLING_TYPE = 1,
    DYNAMIC_BUNDLING_TYPE
 }SchBundlingType;
 
+typedef enum
+{
+   SCH_SET1_SIZE_N4,
+   SCH_SET1_SIZE_WIDEBAND,
+   SCH_SET1_SIZE_N2_WIDEBAND,
+   SCH_SET1_SIZE_N4_WIDEBAND
+}SchBundlingSizeSet1;
+
+typedef enum
+{
+   SCH_SET2_SIZE_N4,
+   SCH_SET2_SIZE_WIDEBAND
+}SchBundlingSizeSet2;
+
 typedef enum
 {
    DUPLEX_MODE_FDD,
@@ -976,6 +999,20 @@ typedef struct schPdschTimeDomRsrcAlloc
    uint8_t    symbolLength;
 }SchPdschTimeDomRsrcAlloc;
 
+
+typedef struct schPdschBundling
+{
+   struct schStaticBundling
+   {
+     SchBundlingSizeSet2 size;
+   }SchStaticBundling;
+   struct schDynamicBundling
+   {
+     SchBundlingSizeSet1 sizeSet1;
+     SchBundlingSizeSet2 sizeSet2;
+   }SchDynamicBundling;
+}SchPdschBundling;
+
 /* DMRS downlink configuration */
 typedef struct schDmrsDlCfg
 {
@@ -992,6 +1029,7 @@ typedef struct schPdschConfig
    SchRBGSize                 rbgSize;
    SchCodeWordsSchedByDci     numCodeWordsSchByDci;                    /* Number of code words scheduled by DCI */
    SchBundlingType            bundlingType;
+   SchPdschBundling           bundlingInfo;
 }SchPdschConfig;
 
 /* Initial Downlink BWP */
@@ -1055,6 +1093,7 @@ typedef struct schPuschTimeDomRsrcAlloc
 /* PUSCH Configuration */
 typedef struct schPuschCfg
 {
+   uint8_t                    dataScramblingId;
    SchDmrsUlCfg               dmrsUlCfgForPuschMapTypeA;
    SchResourceAllocType       resourceAllocType;
    uint8_t                    numTimeDomRsrcAlloc;
@@ -1131,7 +1170,7 @@ typedef struct schGrbQosFlowInfo
 /* DRB QoS */
 typedef struct schDrbQos
 {
-   uint8_t  fiveQiType;   /* Dynamic or non-dynamic */ 
+   SchQosType  fiveQiType;   /* Dynamic or non-dynamic */ 
    union
    {
       SchNonDynFiveQi   nonDyn5Qi;
@@ -1179,7 +1218,7 @@ typedef struct schLcCfg
    SchDrbQosInfo  *drbQos;
    SchSnssai      *snssai;
    SchDlLcCfg     dlLcCfg;
-   SchUlLcCfg     *ulLcCfg;
+   SchUlLcCfg     ulLcCfg;
 }SchLcCfg;
 
 /* Aggregate max bit rate */
@@ -1290,6 +1329,13 @@ typedef uint8_t (*MacSchSrUciIndFunc) ARGS((
         Pst         *pst,         /* Post structure */
         SrUciIndInfo  *uciInd));    /* UCI IND Info */
 
+typedef uint8_t (*MacSchUeReconfigReqFunc) ARGS((
+        Pst         *pst,           /* Post structure */
+        SchUeCfg    *ueCfgToSch));   /* Scheduler UE Cfg */
+
+typedef uint8_t (*SchUeReCfgRspFunc) ARGS((
+        Pst         *pst,           /* Post structure */
+        SchUeCfgRsp *cfgRsp));       /* Scheduler UE Cfg response */
 
 /* function declarations */
 uint8_t packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
@@ -1321,6 +1367,8 @@ uint8_t packMacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd);
 uint8_t MacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd);
 uint8_t packMacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd);
 uint8_t MacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd);
+uint8_t packMacSchUeReconfigReq(Pst *pst, SchUeCfg *ueCfgToSch);
+uint8_t MacSchUeReconfigReq(Pst *pst, SchUeCfg *ueCfgToSch);
 
 /**********************************************************************
   End of file
index 92667dd..1f35317 100644 (file)
@@ -115,15 +115,22 @@ uint8_t fillBitString(BIT_STRING_t *id, uint8_t unusedBits, uint8_t byteSize, ui
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t bitStringToInt(BIT_STRING_t *bitString, uint16_t *val)
+uint8_t bitStringToInt(BIT_STRING_t *bitString, void *value)
 {
    uint16_t idx;
+   uint32_t *val = NULLP;
+
    if(bitString->buf == NULL || bitString->size <= 0)
    {
       DU_LOG("\nDU_APP : Bit string is empty");
       return RFAILED;
    }
 
+   if(value)
+      val = (uint32_t *)value;
+   else
+      return RFAILED;
+
    for(idx=0; idx< bitString->size-1; idx++)
    {
       *val |= bitString->buf[idx];
index cc4a0b1..3a291d3 100644 (file)
@@ -28,7 +28,7 @@ int  encBufSize;
 int PrepFinalEncBuf(const void *buffer, size_t size, void *encodedBuf);
 uint8_t buildPlmnId(Plmn plmn, uint8_t *buf);
 uint8_t fillBitString(BIT_STRING_t *id, uint8_t unusedBits, uint8_t byteSize, uint8_t val);
-uint8_t bitStringToInt(BIT_STRING_t *bitString, uint16_t *val);
+uint8_t bitStringToInt(BIT_STRING_t *bitString, void *val);
 
 #endif
 
index 75881f3..5b617b1 100644 (file)
 #include "odu_common_codec.h"
 #include "cu_stub_sctp.h"
 #include "cu_f1ap_msg_hdl.h"
+/*header files needed for Ue Context Setup */
+#include<ProtocolIE-Field.h>
+#include "ProtocolExtensionField.h"
+#include "F1AP-PDU.h"
+#include "ProtocolExtensionContainer.h"
+#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 "ControlResourceSet.h"
+#include "SearchSpace.h"
+#include "PDCCH-Config.h"
+#include "PDSCH-TimeDomainResourceAllocation.h"
+#include "PDSCH-TimeDomainResourceAllocationList.h"
+#include "DMRS-DownlinkConfig.h"
+#include "PDSCH-Config.h"
+#include "BWP-DownlinkDedicated.h"
+#include "PUSCH-TimeDomainResourceAllocation.h"
+#include "PUSCH-TimeDomainResourceAllocationList.h"
+#include "DMRS-UplinkConfig.h"
+#include "PUSCH-Config.h"
+#include "SRS-ResourceId.h"
+#include "SRS-Resource.h"
+#include "SRS-ResourceSet.h"
+#include "SRS-Config.h"
+#include "BWP-UplinkDedicated.h"
+#include "PUSCH-ServingCellConfig.h"
+#include "UplinkConfig.h"
+#include "PDSCH-ServingCellConfig.h"
+
+/* MACRO for CUtoDURRCInformation */
+#define CELL_GRP_ID 1
+#define FREQ_DOM_RSRC_SIZE 6
+#define CORESET0_END_PRB   48
+#define CORESET1_NUM_PRB   24
+#define PDCCH_CTRL_RSRC_SET_ONE_ID  1
+#define PDCCH_CTRL_RSRC_SET_ONE_DURATION 2  /* Duration for control resource set id i */
+#define PDCCH_CTRL_RSRC_SET_ONE_PRECOD_GRANULARITY 1   /* Precoded granularity */
+#define PDCCH_SRCH_SPC_TWO_ID 2
+#define NR_PCI 1
+#define SCRAMBLING_ID  NR_PCI
+#define DMRS_ADDITIONAL_POS  0          /* DMRS Additional poistion */
+#define PDCCH_SYMBOL_WITHIN_SLOT 128     /* Symbol within Slot Value */
+#define PDCCH_SRCH_SPC_TWO_AGG_LVL1_CANDIDATE 7   /* Num of candidate at aggregation level 1 */
+#define PDCCH_SRCH_SPC_TWO_AGG_LVL2_CANDIDATE 7   /* Num of candidate at aggregation level 2 */
+#define PDCCH_SRCH_SPC_TWO_AGG_LVL4_CANDIDATE 4   /* Num of candidate at aggregation level 4 */
+#define PDCCH_SRCH_SPC_TWO_AGG_LVL8_CANDIDATE 2   /* Num of candidate at aggregation level 8 */
+#define PDCCH_SRCH_SPC_TWO_AGG_LVL16_CANDIDATE 1  /* Num of candidate at aggregation level 16 */
+#define PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT  0  /* format 0-0 and 1-0 */
+#define PDCCH_SERACH_SPACE_DCI_FORMAT 0
+
+/* MACRO Ddefine for PDSCH Configuration */
+#define PDSCH_K0  0
+#define PDSCH_RES_ALLOC_TYPE       1          /* Resource allocation type */
+#define PDSCH_MAX_CODEWORD_SCH_BY_DCI 0       /* Max num of codewords scheduled by DCI */
+#define PDSCH_RBG_SIZE   0                    /* 0: config1 */
+#define PDSCH_NUM_HARQ_PROC 5
+#define PDSCH_MAPPING_TYPE_A 0
+#define PDSCH_MAPPING_TYPE_B 1
+
+/* MACRO Define for PUSCH Configuration */
+#define PUSCH_K2  3
+
+#define PUSCH_MSG3_DELTA_PREAMBLE 0
+#define PUSCH_P0_NOMINAL_WITH_GRANT -70
+#define PUSCH_TRANSFORM_PRECODER    1      /* 1: Disabled */
+#define PUSCH_MAX_MIMO_LAYERS       1
+#define PUSCH_PROCESS_TYPE2_ENABLED false
+#define PUSCH_MAPPING_TYPE_A        0
+#define PUSCH_MAPPING_TYPE_B        1
+
+/* MACRO defines for SRC config */
+#define SRS_RSRC_ID  1
+#define SRS_RSET_ID  1
+#define SRS_COMB_OFFSET_N2   0
+#define SRS_CYCLIC_SHIFT_N2  0
+#define SRS_FREQ_DOM_POS     0
+#define SRS_FREQ_DOM_SHIFT   0
+#define C_SRS 0
+#define B_SRS 0
+#define B_HOP 0
+#define SRS_SEQ_ID 0
+#define APERIODIC_SRS_RESRC_TRIGGER 1 
+
+/* 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 SR_DELAY_TMR     6
+#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
+#define ACTIVE_UL_BWP_ID 0
+#define SCRAMBLING_ID  NR_PCI
+#define DMRS_ADDITIONAL_POS  0          /* DMRS Additional poistion */
+#define RES_ALLOC_TYPE       1          /* Resource allocation type */
 
 /*******************************************************************
 *
@@ -1550,152 +1682,6 @@ uint8_t BuildAndSendDLRRCMessageTransfer(uint8_t rrcMsgType)
    return ROK;
 }/* End of BuildAndSendDLRRCMessageTransfer */
 
-/*******************************************************************
- *
- * @brief Builds and sends the UE Setup Response
- *
- * @details
- *
- *    Function : BuildAndSendUESetRsp
- *
- *    Functionality: Constructs the UE Setup Response and sends
- *                   it to the DU through SCTP.
- *
- * @params[in] 
- *
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-S16 BuildAndSendUESetRsp()
-{
-   S16  ret;
-   U8   elementCnt;
-   U8   cellCnt;
-   U8   ieId;
-   U8   idx;
-   U8   drbCnt;
-   U8   drbId;
-   F1AP_PDU_t                                                  *f1apMsg = NULL;
-   UEContextSetupResponse_t                    *ueSetRsp;
-   asn_enc_rval_t                                              encRetVal;        /* Encoder return value */
-
-   DU_LOG("\n F1AP : Building UE Context Setup Response\n");
-
-   CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
-   if(f1apMsg == NULLP)
-   {
-      DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
-      return RFAILED;
-   }
-
-   f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
-   CU_ALLOC(f1apMsg->choice.successfulOutcome,
-        sizeof(SuccessfulOutcome_t));
-   if(f1apMsg->choice.successfulOutcome == NULLP)
-   {
-      DU_LOG(" F1AP : Memory allocation for    F1AP-PDU failed");
-      CU_FREE(f1apMsg,sizeof(F1AP_PDU_t));
-      return RFAILED;
-   }
-
-   f1apMsg->choice.successfulOutcome->procedureCode = \
-                                                     ProcedureCode_id_UEContextSetup;
-   f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
-   f1apMsg->choice.successfulOutcome->value.present = \
-                                                     SuccessfulOutcome__value_PR_UEContextSetupResponse;
-   ueSetRsp =
-      &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse;
-   elementCnt = 2;
-   ueSetRsp->protocolIEs.list.count = elementCnt;
-   ueSetRsp->protocolIEs.list.size = \
-                                    elementCnt * sizeof(UEContextSetupResponse_t *);
-
-   /* Initialize the UESetup members */
-   CU_ALLOC(ueSetRsp->protocolIEs.list.array, \
-        ueSetRsp->protocolIEs.list.size);
-   if(ueSetRsp->protocolIEs.list.array == NULLP)
-   {
-      DU_LOG(" F1AP : Memory allocation for UE Setup Response failed");
-      CU_FREE(f1apMsg->choice.successfulOutcome,
-           sizeof(SuccessfulOutcome_t));
-      CU_FREE(f1apMsg,(Size)sizeof(F1AP_PDU_t));
-      return RFAILED;
-   }
-
-   for(idx=0; idx<elementCnt; idx++)
-   {
-      CU_ALLOC(ueSetRsp->protocolIEs.list.array[idx],\
-           sizeof(UEContextSetupResponseIEs_t));
-      if(ueSetRsp->protocolIEs.list.array[idx] == NULLP)
-      {
-        for(ieId=0; ieId<idx; ieId++)
-        {
-           CU_FREE(ueSetRsp->protocolIEs.list.array[ieId],\
-                 sizeof(UEContextSetupResponseIEs_t));
-        }
-        CU_FREE(ueSetRsp->protocolIEs.list.array,\
-              ueSetRsp->protocolIEs.list.size);
-        CU_FREE(f1apMsg->choice.successfulOutcome,\
-              sizeof(SuccessfulOutcome_t));
-        CU_FREE(f1apMsg,sizeof(F1AP_PDU_t));
-        return RFAILED;
-      }
-   }
-
-   idx = 0;
-
-   /*GNB CU UE F1AP ID*/
-   ueSetRsp->protocolIEs.list.array[idx]->id   = \
-                                                 ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
-   ueSetRsp->protocolIEs.list.array[idx]->criticality  =       Criticality_reject;
-   ueSetRsp->protocolIEs.list.array[idx]->value.present = \
-                                                         UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
-   ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = CU_ID;
-
-   /*GNB DU UE F1AP ID*/
-   idx++;
-   ueSetRsp->protocolIEs.list.array[idx]->id   = \
-                                                 ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
-   ueSetRsp->protocolIEs.list.array[idx]->criticality  =       Criticality_reject;
-   ueSetRsp->protocolIEs.list.array[idx]->value.present = \
-                                                         UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
-   ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = DU_ID;
-
-
-   xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
-
-   /* Encode the F1SetupRequest type as APER */
-   memset(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 UE Context Setup Request structure (at %s)\n",\
-           encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
-      return RFAILED;
-   }
-   else
-   {
-      DU_LOG("\n F1AP : Created APER encoded buffer for UE Context Setup Request\n");
-      for(int i=0; i< encBufSize; i++)
-      {
-        printf("%x",encBuf[i]);
-      }
-   }
-
-   /* Sending  msg  */
-   if(SendF1APMsg(CU_APP_MEM_REG,CU_POOL)      !=      ROK)
-   {
-      DU_LOG("\n F1AP : Sending        UE Context Setup Request Failed");
-      return RFAILED;
-   }
-
-   return ROK;
-}/* End of BuildAndSendUESetRsp */
-
 /*******************************************************************
  *
  * @brief Function to set the Dl RRC Msg Type
@@ -2601,7 +2587,7 @@ void FreeDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
  *
  * @details
  *
- *    Function : FreeUESetReq
+ *    Function : FreeUeContextSetupReq
  *
  *    Functionality: Deallocate the memory of BuildUESetReq
  *
@@ -2611,11 +2597,10 @@ void FreeDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
  *
  *
  * ****************************************************************/
-void FreeUESetReq(F1AP_PDU_t  *f1apMsg)
+void FreeUeContextSetupReq(F1AP_PDU_t  *f1apMsg)
 {
-   uint8_t idx=2;
-   uint8_t ieId;
-   UEContextSetupRequest_t       *ueSetReq;
+   uint8_t idx, ieId;
+   UEContextSetupRequest_t  *ueSetReq = NULLP;
 
    if(f1apMsg != NULLP)
    {
@@ -2624,30 +2609,53 @@ void FreeUESetReq(F1AP_PDU_t  *f1apMsg)
         ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
         if(ueSetReq->protocolIEs.list.array != NULLP)
         {
-           if(ueSetReq->protocolIEs.list.array[idx])
+           for(idx = 0; idx < ueSetReq->protocolIEs.list.count; idx++)
            {
-              FreeNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI);
-              idx=6;
               if(ueSetReq->protocolIEs.list.array[idx])
               {
-                 FreeSplCellList(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SCell_ToBeSetup_List);
-                 idx++;
-                 if(ueSetReq->protocolIEs.list.array[idx])
+                 switch(ueSetReq->protocolIEs.list.array[idx]->id)
                  {
-                    FreeSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SRBs_ToBeSetup_List);
-                    idx++;
-                    if(ueSetReq->protocolIEs.list.array[idx])
-                    {
+                     case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                        break;
+                     case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                        break;
+                     case ProtocolIE_ID_id_SpCell_ID:
+                       FreeNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI);
+                       break;
+                    case ProtocolIE_ID_id_ServCellIndex:
+                       break;
+                    case ProtocolIE_ID_id_SpCellULConfigured:
+                       break;
+                    case ProtocolIE_ID_id_CUtoDURRCInformation:
+                       FreeCuToDuInfo(&ueSetReq->protocolIEs.list.array[idx]->value.choice.CUtoDURRCInformation);
+                       break;
+                    case ProtocolIE_ID_id_SCell_ToBeSetup_List:
+                       FreeSplCellList(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SCell_ToBeSetup_List);
+                       break;
+                    case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
+                       FreeSRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.SRBs_ToBeSetup_List);
+                       break;
+                     case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
                        FreeDRBSetup(&ueSetReq->protocolIEs.list.array[idx]->value.choice.DRBs_ToBeSetup_List);
-                    }   
-                 }      
+                       break;
+                     case ProtocolIE_ID_id_RRCContainer:
+                       if(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf != NULLP)
+                       {
+                         CU_ALLOC(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, \
+                         ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
+                       }
+                       break;
+                    default:
+                       printf("\nF1AP: Invalid event type %ld", ueSetReq->protocolIEs.list.array[idx]->id);
+                 }
               }
+              break;
            }
-           for(ieId=0; ieId<ueSetReq->protocolIEs.list.count; ieId++)
+           for(ieId=0; ieId<idx; ieId++)
            {
               if(ueSetReq->protocolIEs.list.array[ieId] != NULLP)
               {
-                 CU_FREE(ueSetReq->protocolIEs.list.array[ieId],sizeof(UEContextSetupRequestIEs_t));
+                 CU_FREE(ueSetReq->protocolIEs.list.array[ieId],sizeof(UEContextSetupRequestIEs_t));
               }
            }
            CU_FREE(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size);
@@ -2658,149 +2666,3160 @@ void FreeUESetReq(F1AP_PDU_t  *f1apMsg)
    }
 }
 
+/**Filling cell group info **/
 /*******************************************************************
  *
- * @brief Builds and sends the UE Setup Request 
+ * @brief Build Control resource set to add/modify list 
  *
  * @details
  *
- *    Function : BuildAndSendUESetReq
+ *    Function : BuildControlRSetToAddModList
  *
- *    Functionality: Constructs the UE Setup Request and sends
- *                   it to the CU through SCTP.
+ *    Functionality: Build Control resource set to add/modify list
  *
  * @params[in] 
+ * struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildAndSendUESetReq(uint8_t cuUeF1apId, uint8_t duUeF1apId, \
-   uint16_t rrcContLen, uint8_t *rrcContainer)
+uint8_t BuildControlRSetToAddModList
+(
+struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList
+)
 {
-   uint8_t   Nrcgiret;
-   uint8_t   SplCellListret;
-   uint8_t   SrbSetupret;
-   uint8_t   elementCnt;
-   uint8_t   idx;
-   uint8_t   idx1;
-   F1AP_PDU_t          *f1apMsg = NULLP;
-   UEContextSetupRequest_t *ueSetReq = NULLP;
-   asn_enc_rval_t encRetVal;        /* Encoder return value */
-   memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
-   uint8_t ret= RFAILED;
-   uint8_t ret1;
-   while(true)
+   uint8_t idx;
+   uint8_t elementCnt;
+   uint8_t numBytes, bitsUnused;
+   struct ControlResourceSet *controlRSet;
+   uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
+   uint8_t coreset0EndPrb, coreset1StartPrb, coreset1NumPrb;
+
+   elementCnt = 1;
+   controlRSetList->list.count = elementCnt;
+   controlRSetList->list.size = \
+       elementCnt * sizeof(struct ControlResourceSet *);
+
+   controlRSetList->list.array = NULLP;
+   CU_ALLOC(controlRSetList->list.array, controlRSetList->list.size);
+   if(!controlRSetList->list.array)
    {
-      DU_LOG("\n F1AP : Building UE Context Setup Request\n");
+      DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
+      return RFAILED;
+   }
 
-      CU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
-      if(f1apMsg == NULLP)
+   for(idx = 0; idx < elementCnt; idx++)
+   {
+      controlRSetList->list.array[idx] = NULLP;
+      CU_ALLOC(controlRSetList->list.array[idx], sizeof(struct ControlResourceSet));
+      if(!controlRSetList->list.array[idx])
       {
-        DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
-        break;
+         DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
+         return RFAILED;
       }
+   }
 
-      f1apMsg->present = F1AP_PDU_PR_initiatingMessage;
-      CU_ALLOC(f1apMsg->choice.initiatingMessage,sizeof(InitiatingMessage_t));
-      if(f1apMsg->choice.initiatingMessage == NULLP)
+   idx=0;
+   controlRSet = controlRSetList->list.array[idx];
+   controlRSet->controlResourceSetId = PDCCH_CTRL_RSRC_SET_ONE_ID;
+
+   /* Values harcoded according to our design:
+    * size 6 bytes
+    * 3 LSBs unsued
+    * Bit string stored ff0000000000
+    */
+   numBytes = 6;
+   bitsUnused = 3;
+   controlRSet->frequencyDomainResources.size = numBytes * sizeof(uint8_t);
+   controlRSet->frequencyDomainResources.buf = NULLP;
+       CU_ALLOC(controlRSet->frequencyDomainResources.buf, \
+          controlRSet->frequencyDomainResources.size);
+       if(!controlRSet->frequencyDomainResources.buf)
+       {
+          DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
+               return RFAILED;
+   }
+
+   memset(controlRSet->frequencyDomainResources.buf, 0, FREQ_DOM_RSRC_SIZE);
+   coreset0EndPrb = CORESET0_END_PRB;
+   coreset1StartPrb = coreset0EndPrb + 6;
+   coreset1NumPrb = CORESET1_NUM_PRB;
+   /* calculate the PRBs */
+   freqDomRscAllocType0(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
+   memcpy(controlRSet->frequencyDomainResources.buf, freqDomainResource, FREQ_DOM_RSRC_SIZE);
+   controlRSet->frequencyDomainResources.bits_unused = bitsUnused;
+
+   controlRSet->duration = PDCCH_CTRL_RSRC_SET_ONE_DURATION;
+   controlRSet->cce_REG_MappingType.present = \
+      ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved;
+
+   controlRSet->precoderGranularity = PDCCH_CTRL_RSRC_SET_ONE_PRECOD_GRANULARITY;
+   controlRSet->tci_StatesPDCCH_ToAddList = NULLP;
+       controlRSet->tci_StatesPDCCH_ToReleaseList = NULLP;
+       controlRSet->tci_PresentInDCI = NULLP;
+#if 0
+   uint8_t tciStateIdx;
+
+   CU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList, \
+      sizeof(struct ControlResourceSet__tci_StatesPDCCH_ToAddList));
+   if(!controlRset->tci_StatesPDCCH_ToAddList)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
+      return RFAILED;
+   }
+
+   elementCnt = 1;
+   controlRset->tci_StatesPDCCH_ToAddList->list.count = elementCnt;
+   controlRset->tci_StatesPDCCH_ToAddList->list.size = elementCnt * sizeof(TCI_StateId_t *);
+   CU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList->list.array, \
+      controlRset->tci_StatesPDCCH_ToAddList->list.size)
+   if(!controlRset->tci_StatesPDCCH_ToAddList->list.array)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
+      return RFAILED;
+   }
+   
+   for(tciStateIdx = 0; tciStateIdx <elementCntl; tciStateIdx++)
+   {
+      CU_ALLOC(controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx], sizeof(TCI_StateId_t));
+      if(!controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx])
       {
-        DU_LOG(" F1AP : Memory allocation for  F1AP-PDU failed");
-        break;
+         DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
+         return RFAILED;
       }
+   }
 
-      f1apMsg->choice.initiatingMessage->procedureCode = \
-        ProcedureCode_id_UEContextSetup;
-      f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
-      f1apMsg->choice.initiatingMessage->value.present = \
-         InitiatingMessage__value_PR_UEContextSetupRequest;
-      ueSetReq =
-        &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
-
-      elementCnt = 11;
-      ueSetReq->protocolIEs.list.count = elementCnt;
-      ueSetReq->protocolIEs.list.size = \
-                                       elementCnt * sizeof(UEContextSetupRequestIEs_t *);
+   tciStateIdx = 0;
+   /* TODO */
+   *(controlRset->tci_StatesPDCCH_ToAddList->list.array[tciStateIdx]);
 
-      /* Initialize the UESetup members */
-      CU_ALLOC(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size);
+   CU_ALLOC(controlRset->tci_PresentInDCI, sizeof(long));
+   if(!controlRset->tci_PresentInDCI)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
+      return RFAILED;
+   }
+   /* TODO */
+   *(controlRset->tci_PresentInDCI);
+#endif
 
-      if(ueSetReq->protocolIEs.list.array == NULLP)
-      {
-        DU_LOG(" F1AP : Memory allocation for UE Context SetupRequest failed");
-        break;
-      }
+   controlRSet->pdcch_DMRS_ScramblingID = NULLP;
+   CU_ALLOC(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
+   if(!controlRSet->pdcch_DMRS_ScramblingID)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildControlRSetToAddModList");
+      return RFAILED;
+   }
+   *(controlRSet->pdcch_DMRS_ScramblingID) = SCRAMBLING_ID;
 
-      for(idx1=0; idx1<elementCnt; idx1++)
-      {
-        CU_ALLOC(ueSetReq->protocolIEs.list.array[idx1],sizeof(UEContextSetupRequestIEs_t));
-        if(ueSetReq->protocolIEs.list.array[idx1] == NULLP)
-        {
-           break;
-        }
-      }
+   return ROK;
+} /* End BuildControlRSetToAddModList */
 
-      idx = 0;
+/*******************************************************************
+ *
+ * @brief Build search space to add/modify list
+ *
+ * @details
+ *
+ *    Function : BuildSearchSpcToAddModList
+ *
+ *    Functionality: Build search space to add/modify list
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildSearchSpcToAddModList
+(
+struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
+)
+{
+   uint8_t idx;
+       uint8_t numBytes;
+       uint8_t byteIdx;
+       uint8_t bitsUnused;
+   uint8_t elementCnt;
+   struct SearchSpace *searchSpc;
 
-      /*GNB CU UE F1AP ID*/
-      ueSetReq->protocolIEs.list.array[idx]->id        = \
-                                                 ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
-      ueSetReq->protocolIEs.list.array[idx]->criticality       =       Criticality_reject;
-      ueSetReq->protocolIEs.list.array[idx]->value.present = \
-                                                            UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
-      ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = cuUeF1apId;
+   elementCnt = 1;
+   searchSpcList->list.count = elementCnt;
+   searchSpcList->list.size = elementCnt * sizeof(struct SearchSpace *);
 
-      /*GNB DU UE F1AP ID*/
-      idx++;
-      ueSetReq->protocolIEs.list.array[idx]->id        = \
-                                                 ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
-      ueSetReq->protocolIEs.list.array[idx]->criticality       =       Criticality_ignore;
-      ueSetReq->protocolIEs.list.array[idx]->value.present = \
-                                                            UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
-      ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = duUeF1apId;
+       searchSpcList->list.array = NULLP;
+   CU_ALLOC(searchSpcList->list.array, searchSpcList->list.size);
+   if(!searchSpcList->list.array)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+      return RFAILED;
+   }
 
-      /*Special Cell ID*/
-      idx++;
-      ueSetReq->protocolIEs.list.array[idx]->id        = \
-                                                 ProtocolIE_ID_id_SpCell_ID;
-      ueSetReq->protocolIEs.list.array[idx]->criticality       =       Criticality_reject;
-      ueSetReq->protocolIEs.list.array[idx]->value.present = \
-                                                            UEContextSetupRequestIEs__value_PR_NRCGI;
-      Nrcgiret = BuildNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI);
-      if(Nrcgiret != ROK)
+   for(idx = 0; idx < elementCnt; idx++)
+   {
+          searchSpcList->list.array[idx] = NULLP;
+      CU_ALLOC(searchSpcList->list.array[idx], sizeof(struct SearchSpace));
+      if(!searchSpcList->list.array[idx])
       {
-        break;
+         DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+         return RFAILED;
       }
+   }
 
-      /*Served Cell Index*/
-      idx++;
-      ueSetReq->protocolIEs.list.array[idx]->id        = \
-                                                 ProtocolIE_ID_id_ServCellIndex;
-      ueSetReq->protocolIEs.list.array[idx]->criticality       =       Criticality_reject;
-      ueSetReq->protocolIEs.list.array[idx]->value.present = \
-                                                            UEContextSetupRequestIEs__value_PR_ServCellIndex;
-      ueSetReq->protocolIEs.list.array[idx]->value.choice.ServCellIndex = \
-                                                                         CELL_INDEX;
+   idx = 0;
+   searchSpc = searchSpcList->list.array[idx];
 
-      /*CellULConfigured*/
-      idx++;
-      ueSetReq->protocolIEs.list.array[idx]->id        = \
-                                                 ProtocolIE_ID_id_SpCellULConfigured;
-      ueSetReq->protocolIEs.list.array[idx]->criticality       =       Criticality_ignore;
-      ueSetReq->protocolIEs.list.array[idx]->value.present = \
-                                                            UEContextSetupRequestIEs__value_PR_CellULConfigured;
-      ueSetReq->protocolIEs.list.array[idx]->value.choice.CellULConfigured = \
-                                                                            CellULConfigured_none;
+   searchSpc->searchSpaceId = PDCCH_SRCH_SPC_TWO_ID;
 
+   searchSpc->controlResourceSetId = NULLP;
+   CU_ALLOC(searchSpc->controlResourceSetId, sizeof(ControlResourceSetId_t));
+   if(!searchSpc->controlResourceSetId)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+      return RFAILED;
+   }
+   *(searchSpc->controlResourceSetId) = PDCCH_CTRL_RSRC_SET_ONE_ID;
+
+   searchSpc->monitoringSlotPeriodicityAndOffset = NULLP;
+   CU_ALLOC(searchSpc->monitoringSlotPeriodicityAndOffset, \
+      sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
+   if(!searchSpc->monitoringSlotPeriodicityAndOffset)
+       {
+          DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+               return RFAILED;
+       }
+   searchSpc->monitoringSlotPeriodicityAndOffset->present = \
+          SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
+  
+   searchSpc->duration = NULLP;
+   searchSpc->monitoringSymbolsWithinSlot = NULLP;
+       CU_ALLOC(searchSpc->monitoringSymbolsWithinSlot, sizeof(BIT_STRING_t));
+       if(!searchSpc->monitoringSymbolsWithinSlot)
+       {
+          DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+               return RFAILED;
+       }
+   
+       /* Values taken from reference logs :
+        * size 2 bytes
+        * 2 LSBs unsued
+        * Bit string stores 8000
+        */
+   numBytes = 2;
+       bitsUnused = 2;
+
+   searchSpc->monitoringSymbolsWithinSlot->size = numBytes * sizeof(uint8_t);
+       searchSpc->monitoringSymbolsWithinSlot->buf = NULLP;
+       CU_ALLOC(searchSpc->monitoringSymbolsWithinSlot->buf, \
+          searchSpc->monitoringSymbolsWithinSlot->size);
+       if(!searchSpc->monitoringSymbolsWithinSlot->buf)
+       {
+          DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+               return RFAILED;
+       }
+
+       byteIdx = 0;
+       searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = \
+        PDCCH_SYMBOL_WITHIN_SLOT /* setting MSB to 128 i.e. 0x80 */;
+       searchSpc->monitoringSymbolsWithinSlot->buf[byteIdx++] = 0;
+       searchSpc->monitoringSymbolsWithinSlot->bits_unused = bitsUnused;
+
+   searchSpc->nrofCandidates = NULLP;
+   CU_ALLOC(searchSpc->nrofCandidates, sizeof(struct SearchSpace__nrofCandidates));
+   if(!searchSpc->nrofCandidates)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+      return RFAILED;
+   }
 
-      /*CUtoDURRCContainer*/
-      idx++;
-      ueSetReq->protocolIEs.list.array[idx]->id        = \
-                                                 ProtocolIE_ID_id_CUtoDURRCInformation;
-      ueSetReq->protocolIEs.list.array[idx]->criticality       =       Criticality_reject;
+   searchSpc->nrofCandidates->aggregationLevel1 = \
+          PDCCH_SRCH_SPC_TWO_AGG_LVL1_CANDIDATE;
+   searchSpc->nrofCandidates->aggregationLevel2 = \
+          PDCCH_SRCH_SPC_TWO_AGG_LVL2_CANDIDATE;
+   searchSpc->nrofCandidates->aggregationLevel4 = \
+          PDCCH_SRCH_SPC_TWO_AGG_LVL4_CANDIDATE;
+   searchSpc->nrofCandidates->aggregationLevel8 = \
+          PDCCH_SRCH_SPC_TWO_AGG_LVL8_CANDIDATE;
+   searchSpc->nrofCandidates->aggregationLevel16 = \
+          PDCCH_SRCH_SPC_TWO_AGG_LVL16_CANDIDATE;
+
+   searchSpc->searchSpaceType = NULLP;
+   CU_ALLOC(searchSpc->searchSpaceType, sizeof(struct SearchSpace__searchSpaceType));
+   if(!searchSpc->searchSpaceType)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+      return RFAILED;
+   }
+   
+   searchSpc->searchSpaceType->present = SearchSpace__searchSpaceType_PR_ue_Specific;
+
+   searchSpc->searchSpaceType->choice.ue_Specific = NULLP;
+   CU_ALLOC(searchSpc->searchSpaceType->choice.ue_Specific, \
+      sizeof(struct SearchSpace__searchSpaceType__ue_Specific));
+   if(!searchSpc->searchSpaceType->choice.ue_Specific)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildSearchSpcToAddModList");
+      return RFAILED;
+   }  
+   searchSpc->searchSpaceType->choice.ue_Specific->dci_Formats = \
+          PDCCH_SRCH_SPC_TWO_UE_SPEC_DCI_FORMAT;
+
+   return ROK;
+}/* End BuildSearchSpcToAddModList */
+
+/*******************************************************************
+ *
+ * @brief Builds BWP DL dedicated PDCCH config
+ *
+ * @details
+ *
+ *    Function : BuildBWPDlDedPdcchCfg
+ *
+ *    Functionality: Builds BWP DL dedicated PDCCH config
+ *
+ * @params[in] struct PDCCH_Config *pdcchCfg
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildBWPDlDedPdcchCfg(struct PDCCH_Config *pdcchCfg)
+{
+   pdcchCfg->controlResourceSetToAddModList = NULLP;
+   CU_ALLOC(pdcchCfg->controlResourceSetToAddModList, \
+      sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
+   if(!pdcchCfg->controlResourceSetToAddModList)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdcchCfg");
+      return RFAILED;
+   }
+
+       if(BuildControlRSetToAddModList(pdcchCfg->controlResourceSetToAddModList) != ROK)
+       {
+          return RFAILED;
+       }
+  
+   pdcchCfg->controlResourceSetToReleaseList = NULLP;
+
+   pdcchCfg->searchSpacesToAddModList = NULLP;
+       CU_ALLOC(pdcchCfg->searchSpacesToAddModList, \
+          sizeof(struct PDCCH_Config__searchSpacesToAddModList));
+       if(!pdcchCfg->searchSpacesToAddModList)
+       {
+          DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdcchCfg");
+               return RFAILED;
+       }
+  
+       if(BuildSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList) != ROK)
+       {
+          return RFAILED;
+       }
+   
+   pdcchCfg->searchSpacesToReleaseList = NULLP;
+       pdcchCfg->downlinkPreemption = NULLP;
+       pdcchCfg->tpc_PUSCH = NULLP;
+       pdcchCfg->tpc_PUCCH = NULLP;
+       pdcchCfg->tpc_SRS = NULLP;
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds DMRS DL PDSCH Mapping type A
+ *
+ * @details
+ *
+ *    Function : BuildDMRSDLPdschMapTypeA
+ *
+ *    Functionality: Builds DMRS DL PDSCH Mapping type A
+ *
+ * @params[in]
+ * struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildDMRSDLPdschMapTypeA
+(
+struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg
+)
+{
+   dmrsDlCfg->present = PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup;
+       dmrsDlCfg->choice.setup = NULLP;
+   CU_ALLOC(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
+   if(!dmrsDlCfg->choice.setup)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
+      return RFAILED;
+   }
+        
+       dmrsDlCfg->choice.setup->dmrs_Type = NULLP;
+       dmrsDlCfg->choice.setup->dmrs_AdditionalPosition = NULLP;
+   CU_ALLOC(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition, sizeof(long));
+   if(!dmrsDlCfg->choice.setup->dmrs_AdditionalPosition)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildDMRSDLPdschMapTypeA");
+      return RFAILED;
+   }
+   *(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition) = DMRS_ADDITIONAL_POS;
+         
+       dmrsDlCfg->choice.setup->maxLength = NULLP;
+       dmrsDlCfg->choice.setup->scramblingID0 = NULLP;
+       dmrsDlCfg->choice.setup->scramblingID1 = NULLP;
+       dmrsDlCfg->choice.setup->phaseTrackingRS = NULLP;
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds TCI states to add/modify list
+ *
+ * @details
+ *
+ *    Function : BuildTCIStatesToAddModList
+ *
+ *    Functionality:Builds TCI states to add/modify list
+ *
+ * @params[in] 
+ * struct PDSCH_Config__tci_StatesToAddModList *tciStatesList
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildTCIStatesToAddModList(struct PDSCH_Config__tci_StatesToAddModList *tciStatesList)
+{
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds PDSCH time domain allocation list
+ *
+ * @details
+ *
+ *    Function : BuildPdschTimeDomAllocList
+ *
+ *    Functionality: Builds PDSCH time domain allocation list
+ *
+ * @params[in] 
+ * struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildPdschTimeDomAllocList
+(
+struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
+)
+{
+   uint8_t idx;
+   uint8_t elementCnt;
+       struct PDSCH_TimeDomainResourceAllocation *timeDomAlloc;
+
+   timeDomAllocList->present = \
+          PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup;
+
+   timeDomAllocList->choice.setup = NULLP;
+   CU_ALLOC(timeDomAllocList->choice.setup, \
+          sizeof(struct PDSCH_TimeDomainResourceAllocationList));
+   if(!timeDomAllocList->choice.setup)
+       {
+          DU_LOG("\nF1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+               return RFAILED;
+       }
+         
+       elementCnt = 1;
+       timeDomAllocList->choice.setup->list.count = elementCnt;
+       timeDomAllocList->choice.setup->list.size = \
+          elementCnt * sizeof(struct PDSCH_TimeDomainResourceAllocation *);
+
+       timeDomAllocList->choice.setup->list.array = NULLP;
+       CU_ALLOC(timeDomAllocList->choice.setup->list.array, \
+          timeDomAllocList->choice.setup->list.size);
+       if(!timeDomAllocList->choice.setup->list.array)
+       {
+          DU_LOG("\nF1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+               return RFAILED;
+       }
+
+       for(idx = 0; idx < elementCnt; idx++)
+       {
+          timeDomAllocList->choice.setup->list.array[idx] = NULLP;
+          CU_ALLOC(timeDomAllocList->choice.setup->list.array[idx], \
+                  sizeof(struct PDSCH_TimeDomainResourceAllocation));
+               if(!timeDomAllocList->choice.setup->list.array[idx])
+               {
+                  DU_LOG("\nF1AP : Memory allocation failed in BuildPdschTimeDomAllocList");
+                       return RFAILED;
+               }
+       }
+
+       idx = 0;
+       timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
+
+   timeDomAlloc->k0 = NULLP;
+   timeDomAlloc->mappingType = PDSCH_MAPPING_TYPE_A;
+   timeDomAlloc->startSymbolAndLength = 53;
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds PDSCH PRB Bundling type
+ *
+ * @details
+ *
+ *    Function : BuildPdschPrbBundlingType
+ *
+ *    Functionality: Builds PDSCH PRB Bundling type
+ *
+ * @params[in] 
+ * struct PDSCH_Config__prb_BundlingType *prbBndlType
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildPdschPrbBundlingType
+(
+struct PDSCH_Config__prb_BundlingType *prbBndlType
+)
+{
+   prbBndlType->present = PDSCH_Config__prb_BundlingType_PR_staticBundling;
+
+   prbBndlType->choice.staticBundling = NULLP;
+       CU_ALLOC(prbBndlType->choice.staticBundling, \
+          sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
+       if(!prbBndlType->choice.staticBundling)
+       {
+          DU_LOG("\nF1AP : Memory allocation failed in BuildPdschPrbBundlingType");
+               return RFAILED;
+       }
+       prbBndlType->choice.staticBundling->bundleSize = NULLP;
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds BWP DL dedicated PDSCH config 
+ *
+ * @details
+ *
+ *    Function : BuildBWPDlDedPdschCfg
+ *
+ *    Functionality: Builds BWP DL dedicated PDSCH config
+ *
+ * @params[in] struct PDSCH_Config *pdschCfg
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildBWPDlDedPdschCfg(struct PDSCH_Config *pdschCfg)
+{
+   pdschCfg->dataScramblingIdentityPDSCH = NULLP;
+
+   pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA = NULLP;
+   CU_ALLOC(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, \
+      sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
+   if(!pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
+      return RFAILED;
+   }
+
+   if(BuildDMRSDLPdschMapTypeA(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA) != ROK)
+   {
+      return RFAILED;
+   }
+
+   pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeB = NULLP;
+   pdschCfg->tci_StatesToAddModList = NULLP;
+   pdschCfg->tci_StatesToReleaseList = NULLP;
+       pdschCfg->vrb_ToPRB_Interleaver = NULLP;
+#if 0
+   CU_ALLOC(pdschCfg->tci_StatesToAddModList, sizeof(struct PDSCH_Config__tci_StatesToAddModList));
+   if(!pdschCfg->tci_StatesToAddModList)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
+      return RFAILED;
+   }
+   if(BuildTCIStatesToAddModList(pdschCfg->tci_StatesToAddModList) != ROK)
+   {
+      return RFAILED;
+   }
+#endif
+
+       pdschCfg->resourceAllocation = RES_ALLOC_TYPE;
+
+   pdschCfg->pdsch_TimeDomainAllocationList = NULLP;
+       CU_ALLOC(pdschCfg->pdsch_TimeDomainAllocationList, \
+          sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
+   if(!pdschCfg->pdsch_TimeDomainAllocationList)
+       {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
+               return RFAILED;
+       }
+       if(BuildPdschTimeDomAllocList(pdschCfg->pdsch_TimeDomainAllocationList) != ROK)
+       {
+          return RFAILED;
+       }
+   pdschCfg->pdsch_AggregationFactor = NULLP;
+       pdschCfg->rateMatchPatternToAddModList = NULLP;
+       pdschCfg->rateMatchPatternToReleaseList = NULLP;
+       pdschCfg->rateMatchPatternGroup1 = NULLP;
+       pdschCfg->rateMatchPatternGroup2 = NULLP;
+       pdschCfg->rbg_Size = PDSCH_RBG_SIZE;
+       pdschCfg->mcs_Table = NULLP;
+
+       pdschCfg->maxNrofCodeWordsScheduledByDCI = NULLP;
+       CU_ALLOC(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
+       if(!pdschCfg->maxNrofCodeWordsScheduledByDCI)
+       {
+          DU_LOG("\nF1AP : Memory allocation failed in BuildBWPDlDedPdschCfg");
+               return RFAILED;
+       }
+       *(pdschCfg->maxNrofCodeWordsScheduledByDCI) = PDSCH_MAX_CODEWORD_SCH_BY_DCI;
+       
+       if(BuildPdschPrbBundlingType(&pdschCfg->prb_BundlingType) != ROK)
+       {
+          return RFAILED;
+       }
+
+       pdschCfg->zp_CSI_RS_ResourceToAddModList = NULLP;
+       pdschCfg->zp_CSI_RS_ResourceToReleaseList = NULLP;
+       pdschCfg->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList = NULLP;
+       pdschCfg->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList = NULLP;
+       pdschCfg->sp_ZP_CSI_RS_ResourceSetsToAddModList = NULLP;
+       pdschCfg->sp_ZP_CSI_RS_ResourceSetsToReleaseList = NULLP;
+   pdschCfg->p_ZP_CSI_RS_ResourceSet = NULLP;
+
+   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)
+{
+   dlBwp->pdcch_Config = NULLP;
+   CU_ALLOC(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
+       if(!dlBwp->pdcch_Config)
+       {
+          DU_LOG("\nF1AP : Memory Allocation failure in BuildInitialDlBWP");
+      return RFAILED;
+       }
+       dlBwp->pdcch_Config->present = BWP_DownlinkDedicated__pdcch_Config_PR_setup; 
+
+   dlBwp->pdcch_Config->choice.setup = NULLP;
+       CU_ALLOC(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
+   if(!dlBwp->pdcch_Config->choice.setup)
+   {
+          DU_LOG("\nF1AP : Memory Allocation failure in BuildInitialDlBWP");
+               return RFAILED;
+       }
+   if(BuildBWPDlDedPdcchCfg(dlBwp->pdcch_Config->choice.setup) != ROK)
+       {
+          return RFAILED;
+       }
+
+   dlBwp->pdsch_Config = NULLP;
+       CU_ALLOC(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
+       if(!dlBwp->pdsch_Config)
+       {
+          DU_LOG("\nF1AP : Memory Allocation failure in BuildInitialDlBWP");
+               return RFAILED;
+       }
+       dlBwp->pdsch_Config->present = BWP_DownlinkDedicated__pdsch_Config_PR_setup;
+
+   dlBwp->pdsch_Config->choice.setup = NULLP;
+   CU_ALLOC(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
+   if(!dlBwp->pdsch_Config->choice.setup)
+   {
+      DU_LOG("\nF1AP : Memory Allocation failure in BuildInitialDlBWP");
+               return RFAILED;
+       }
+
+   if(BuildBWPDlDedPdschCfg(dlBwp->pdsch_Config->choice.setup) != ROK)
+       {
+          return RFAILED;
+       }
+
+   dlBwp->sps_Config = NULLP;
+   dlBwp->radioLinkMonitoringConfig = NULLP; 
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds DMRS UL Pusch Mapping type A
+ *
+ * @details
+ *
+ *    Function : BuildDMRSULPuschMapTypeA
+ *
+ *    Functionality: Builds DMRS UL Pusch Mapping type A
+ *
+ * @params[in] 
+ *    struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildDMRSULPuschMapTypeA
+(
+struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg
+)
+{
+   dmrsUlCfg->present = PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup;
+   dmrsUlCfg->choice.setup= NULLP;
+   CU_ALLOC(dmrsUlCfg->choice.setup, sizeof(DMRS_UplinkConfig_t));
+   if(!dmrsUlCfg->choice.setup)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
+      return RFAILED;
+   }
+         
+   dmrsUlCfg->choice.setup->dmrs_Type = NULLP;
+       dmrsUlCfg->choice.setup->dmrs_AdditionalPosition = NULLP;
+   CU_ALLOC(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition, sizeof(long));
+   if(!dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
+      return RFAILED;
+   }
+   *(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition) = DMRS_ADDITIONAL_POS; 
+
+       dmrsUlCfg->choice.setup->phaseTrackingRS = NULLP;
+       dmrsUlCfg->choice.setup->maxLength = NULLP;
+   dmrsUlCfg->choice.setup->transformPrecodingDisabled = NULLP;
+   CU_ALLOC(dmrsUlCfg->choice.setup->transformPrecodingDisabled, \
+      sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
+   if(!dmrsUlCfg->choice.setup->transformPrecodingDisabled)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
+      return RFAILED;
+   }
+
+   dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0 = NULLP;
+   CU_ALLOC(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
+      sizeof(long));
+   if(!dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildDMRSULPuschMapTypeA");
+      return RFAILED;
+   }
+   *(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0) = SCRAMBLING_ID;
+
+       dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID1 = NULLP;
+       dmrsUlCfg->choice.setup->transformPrecodingEnabled = NULLP;
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Build PUSCH time domain allocation list
+ *
+ * @details
+ *
+ *    Function : BuildPuschTimeDomAllocList
+ *
+ *    Functionality: Build PUSCH time domain allocation list
+ *
+ * @params[in] 
+ * struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildPuschTimeDomAllocList
+(
+struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList
+)
+{
+   uint8_t idx;
+   uint8_t elementCnt;
+   PUSCH_TimeDomainResourceAllocation_t  *timeDomAlloc;
+
+   timeDomAllocList->present = PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup;
+   timeDomAllocList->choice.setup = NULLP;
+   CU_ALLOC(timeDomAllocList->choice.setup, \
+      sizeof(struct PUSCH_TimeDomainResourceAllocationList));
+   if(!timeDomAllocList->choice.setup)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
+      return RFAILED;
+   }
+         
+   elementCnt = 1;
+   timeDomAllocList->choice.setup->list.count = elementCnt;
+   timeDomAllocList->choice.setup->list.size = \
+      elementCnt * sizeof(PUSCH_TimeDomainResourceAllocation_t *);
+       timeDomAllocList->choice.setup->list.array = NULLP;
+   CU_ALLOC(timeDomAllocList->choice.setup->list.array, \
+      timeDomAllocList->choice.setup->list.size);
+   if(!timeDomAllocList->choice.setup->list.array)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
+      return RFAILED;
+   }
+
+   for(idx = 0; idx < elementCnt; idx++)
+   {
+          timeDomAllocList->choice.setup->list.array[idx] = NULLP;
+      CU_ALLOC(timeDomAllocList->choice.setup->list.array[idx],\
+         sizeof(PUSCH_TimeDomainResourceAllocation_t));
+      if(!timeDomAllocList->choice.setup->list.array[idx])
+      {
+         DU_LOG("\nF1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
+         return RFAILED;
+      }
+   }
+
+   idx = 0;
+   timeDomAlloc = timeDomAllocList->choice.setup->list.array[idx];
+   CU_ALLOC(timeDomAlloc->k2, sizeof(long));
+   if(!timeDomAlloc->k2)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildPuschTimeDomAllocList");
+      return RFAILED;
+   }
+   *(timeDomAlloc->k2) = PUSCH_K2;
+   timeDomAlloc->mappingType = PUSCH_MAPPING_TYPE_A;
+   timeDomAlloc->startSymbolAndLength = 27; 
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds BWP UL dedicated PUSCH Config
+ *
+ * @details
+ *
+ *    Function : BuildBWPUlDedPuschCfg
+ *
+ *    Functionality:
+ *      Builds BWP UL dedicated PUSCH Config
+ *
+ * @params[in] : PUSCH_Config_t *puschCfg
+ *    
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildBWPUlDedPuschCfg(PUSCH_Config_t *puschCfg)
+{
+   puschCfg->dataScramblingIdentityPUSCH = NULLP;
+   CU_ALLOC(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
+   if(!puschCfg->dataScramblingIdentityPUSCH)
+   {
+      DU_LOG("\nF1AP: Memory allocation failed in BuildBWPUlDedPuschCfg");
+      return RFAILED;
+   }
+   *(puschCfg->dataScramblingIdentityPUSCH) = SCRAMBLING_ID;
+
+   puschCfg->txConfig = NULLP;
+       puschCfg->dmrs_UplinkForPUSCH_MappingTypeA = NULLP;
+   CU_ALLOC(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \
+      sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
+   if(!puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
+   {
+      DU_LOG("\nF1AP: Memory allocation failed in BuildBWPUlDedPuschCfg");
+      return RFAILED;
+   }
+
+   if(BuildDMRSULPuschMapTypeA(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA) != ROK)
+   {
+      return RFAILED;
+   }
+
+   puschCfg->dmrs_UplinkForPUSCH_MappingTypeB = NULLP;
+       puschCfg->pusch_PowerControl = NULLP;
+       puschCfg->frequencyHopping = NULLP;
+       puschCfg->frequencyHoppingOffsetLists = NULLP;
+   puschCfg->resourceAllocation = RES_ALLOC_TYPE;
+
+   puschCfg->pusch_TimeDomainAllocationList = NULLP;
+   CU_ALLOC(puschCfg->pusch_TimeDomainAllocationList, \
+      sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
+   if(!puschCfg->pusch_TimeDomainAllocationList)
+   {
+      DU_LOG("\nF1AP: Memory allocation failed in BuildBWPUlDedPuschCfg");
+      return RFAILED;
+   }
+
+   if(BuildPuschTimeDomAllocList(puschCfg->pusch_TimeDomainAllocationList) != ROK)
+   {
+      return RFAILED;
+   }
+
+   puschCfg->pusch_AggregationFactor = NULLP;
+       puschCfg->mcs_Table = NULLP;
+       puschCfg->mcs_TableTransformPrecoder = NULLP;
+   puschCfg->transformPrecoder = NULLP;
+   CU_ALLOC(puschCfg->transformPrecoder, sizeof(long));
+   if(!puschCfg->transformPrecoder)
+   {
+      DU_LOG("\nF1AP: Memory allocation failed in BuildBWPUlDedPuschCfg");
+      return RFAILED;
+   }
+   *(puschCfg->transformPrecoder) = PUSCH_TRANSFORM_PRECODER;
+
+       puschCfg->codebookSubset = NULLP;
+       puschCfg->maxRank = NULLP;
+       puschCfg->rbg_Size = NULLP;
+       puschCfg->uci_OnPUSCH = NULLP;
+       puschCfg->tp_pi2BPSK = NULLP;
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills SRS resource to add/modify list 
+ *
+ * @details
+ *
+ *    Function : BuildSrsRsrcAddModList
+ *
+ *    Functionality: Fills SRS resource to add/modify list
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildSrsRsrcAddModList(struct SRS_Config__srs_ResourceToAddModList *resourceList)
+{
+   uint8_t   elementCnt;
+   uint8_t   rsrcIdx;
+
+   elementCnt = 1;
+   resourceList->list.count = elementCnt;
+   resourceList->list.size = elementCnt * sizeof(SRS_Resource_t *);
+   resourceList->list.array = NULLP;
+   CU_ALLOC(resourceList->list.array, resourceList->list.size);
+   if(!resourceList->list.array)
+   {
+      DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcAddModList");
+      return RFAILED;
+   }
+   for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
+   {
+      CU_ALLOC(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
+      if(!resourceList->list.array[rsrcIdx])
+      {
+         DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcAddModList");
+         return RFAILED;
+      }
+   }
+
+   rsrcIdx = 0;
+   resourceList->list.array[rsrcIdx]->srs_ResourceId = SRS_RSRC_ID;
+   resourceList->list.array[rsrcIdx]->nrofSRS_Ports = SRS_Resource__nrofSRS_Ports_port1;
+   resourceList->list.array[rsrcIdx]->transmissionComb.present = SRS_Resource__transmissionComb_PR_n2;
+
+   resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2 = NULLP;
+   CU_ALLOC(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2, \
+      sizeof(struct SRS_Resource__transmissionComb__n2));
+   if(!resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2)
+   {
+      DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcAddModList");
+      return RFAILED;
+   }
+   resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->combOffset_n2\
+          = SRS_COMB_OFFSET_N2;
+   resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2->cyclicShift_n2\
+          = SRS_CYCLIC_SHIFT_N2;
+
+   resourceList->list.array[rsrcIdx]->resourceMapping.startPosition = \
+          0;
+   resourceList->list.array[rsrcIdx]->resourceMapping.nrofSymbols =  \
+      SRS_Resource__resourceMapping__nrofSymbols_n1;
+   resourceList->list.array[rsrcIdx]->resourceMapping.repetitionFactor = \
+      SRS_Resource__resourceMapping__repetitionFactor_n1;
+
+   resourceList->list.array[rsrcIdx]->freqDomainPosition = SRS_FREQ_DOM_POS;
+   resourceList->list.array[rsrcIdx]->freqDomainShift = SRS_FREQ_DOM_SHIFT;
+   resourceList->list.array[rsrcIdx]->freqHopping.c_SRS = C_SRS;
+   resourceList->list.array[rsrcIdx]->freqHopping.b_SRS = B_SRS;
+   resourceList->list.array[rsrcIdx]->freqHopping.b_hop = B_HOP;
+   resourceList->list.array[rsrcIdx]->groupOrSequenceHopping = \
+      SRS_Resource__groupOrSequenceHopping_neither;
+
+   /* Setting resource type to aperiodic for intergration purposes */
+   resourceList->list.array[rsrcIdx]->resourceType.present = \
+          SRS_Resource__resourceType_PR_aperiodic;
+   resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic = NULLP;
+   CU_ALLOC(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,
+      sizeof(struct SRS_Resource__resourceType__aperiodic));
+   if(!resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic)
+   {
+      DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcAddModList");
+      return RFAILED;
+   }
+   resourceList->list.array[rsrcIdx]->sequenceId = SRS_SEQ_ID;
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Build SRS resource set Add/mod list
+ *
+ * @details
+ *
+ *    Function : BuildSrsRsrcSetAddModList
+ *
+ *    Functionality: Build SRS resource set Add/mod list
+ *
+ * @params[in] 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildSrsRsrcSetAddModList
+(
+struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList
+)
+{
+   uint8_t  elementCnt;
+   uint8_t  rSetIdx;
+       uint8_t  rsrcIdx;
+       struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList;
+
+   elementCnt = 1;
+   rsrcSetList->list.count = elementCnt;
+   rsrcSetList->list.size = elementCnt * sizeof(SRS_ResourceSet_t *);
+   rsrcSetList->list.array = NULLP;
+   CU_ALLOC(rsrcSetList->list.array, rsrcSetList->list.size);
+   if(!rsrcSetList->list.array)
+   {
+      DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
+      return RFAILED;
+   }
+
+   for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
+   {
+      CU_ALLOC(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
+      if(!rsrcSetList->list.array[rSetIdx])
+      {
+         DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
+         return RFAILED;
+      }
+   }
+
+   rSetIdx = 0;
+   rsrcSetList->list.array[rSetIdx]->srs_ResourceSetId = SRS_RSET_ID;
+
+       /* Fill Resource Id list in resource set */
+       rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList = NULLP;
+       CU_ALLOC(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
+          sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
+       if(!rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
+       {
+          DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
+               return RFAILED;
+       }
+
+       elementCnt = 1;
+       rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
+       rsrcIdList->list.count = elementCnt;
+       rsrcIdList->list.size = elementCnt * sizeof(SRS_ResourceId_t *);
+       rsrcIdList->list.array = NULLP;
+       CU_ALLOC(rsrcIdList->list.array, rsrcIdList->list.size);
+       if(!rsrcIdList->list.array)
+       {
+          DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
+               return RFAILED;
+       }
+
+       for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
+       {
+          CU_ALLOC(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
+               if(!rsrcIdList->list.array[rsrcIdx])
+               {
+                  DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
+                       return RFAILED;
+               }
+       }
+
+       rsrcIdx = 0;
+       *rsrcIdList->list.array[rsrcIdx] = SRS_RSRC_ID;
+
+       /* Fill resource type */
+   rsrcSetList->list.array[rSetIdx]->resourceType.present = \
+      SRS_ResourceSet__resourceType_PR_aperiodic;
+
+   rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic = NULLP;
+   CU_ALLOC(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
+      sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
+   if(!rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic)
+   {
+          DU_LOG("\nF1AP: Memory allocation failed in BuildSrsRsrcSetAddModList");
+               return RFAILED;
+       }
+   rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger \
+          = APERIODIC_SRS_RESRC_TRIGGER;
+
+       /* TODO : Fill values for below IEs as expected by Viavi */
+       rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->csi_RS = NULLP;
+   rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic->slotOffset = NULLP;
+  
+
+   rsrcSetList->list.array[rSetIdx]->usage = SRS_ResourceSet__usage_codebook;
+       rsrcSetList->list.array[rSetIdx]->alpha = NULLP;
+       rsrcSetList->list.array[rSetIdx]->p0 = NULLP;
+       rsrcSetList->list.array[rSetIdx]->pathlossReferenceRS = NULLP;
+       rsrcSetList->list.array[rSetIdx]->srs_PowerControlAdjustmentStates = NULLP;
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds BWP UL dedicated SRS Config
+ *
+ * @details
+ *
+ *    Function : BuildBWPUlDedSrsCfg
+ *
+ *    Functionality: Builds BWP UL dedicated SRS Config
+ *
+ * @params[in] SRS Config 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildBWPUlDedSrsCfg(SRS_Config_t *srsCfg)
+{
+   srsCfg->srs_ResourceSetToReleaseList = NULLP;
+   srsCfg->srs_ResourceSetToAddModList = NULLP;
+   CU_ALLOC(srsCfg->srs_ResourceSetToAddModList, \
+      sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
+   if(!srsCfg->srs_ResourceSetToAddModList)
+   {
+      DU_LOG("\nF1AP: Memory allocation failed in BuildBWPUlDedSrsCfg");
+      return RFAILED;
+   }
+   if(BuildSrsRsrcSetAddModList(srsCfg->srs_ResourceSetToAddModList) != ROK)
+   {
+      return RFAILED;
+   }
+
+   srsCfg->srs_ResourceToReleaseList = NULLP;
+
+   /* Resource to Add/Modify list */
+   srsCfg->srs_ResourceToAddModList = NULLP;
+   CU_ALLOC(srsCfg->srs_ResourceToAddModList, \
+      sizeof(struct SRS_Config__srs_ResourceToAddModList));
+   if(!srsCfg->srs_ResourceToAddModList)
+   {
+      DU_LOG("\nF1AP: Memory allocation failed in BuildBWPUlDedSrsCfg");
+      return RFAILED;
+   }
+
+   if(BuildSrsRsrcAddModList(srsCfg->srs_ResourceToAddModList) != ROK)
+   {
+      return RFAILED;
+   }
+
+   srsCfg->tpc_Accumulation = NULLP;
+
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds inital UL BWP
+ *
+ * @details
+ *
+ *    Function : BuildInitialUlBWP
+ *
+ *    Functionality: Builds initial UL BWP
+ *
+ * @params[in] BWP_UplinkDedicated_t *ulBwp
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
+{
+   ulBwp->pucch_Config = NULLP;
+
+   /* Fill BWP UL dedicated PUSCH config */
+       ulBwp->pusch_Config = NULLP;
+   CU_ALLOC(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
+   if(!ulBwp->pusch_Config)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildInitialUlBWP");
+      return RFAILED;
+   }
+   
+   ulBwp->pusch_Config->present = BWP_UplinkDedicated__pusch_Config_PR_setup;
+   ulBwp->pusch_Config->choice.setup = NULLP;
+   CU_ALLOC(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
+   if(!ulBwp->pusch_Config->choice.setup)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildInitialUlBWP");
+      return RFAILED;
+   }
+
+   if(BuildBWPUlDedPuschCfg(ulBwp->pusch_Config->choice.setup) != ROK)
+   {
+      return RFAILED;
+   }
+
+       ulBwp->configuredGrantConfig = NULLP;
+
+   /* Fill BPW UL dedicated SRS config */
+       ulBwp->srs_Config = NULLP;
+   CU_ALLOC(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
+   if(!ulBwp->srs_Config)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildInitialUlBWP");
+      return RFAILED;
+   }
+
+   ulBwp->srs_Config->present = BWP_UplinkDedicated__srs_Config_PR_setup;
+   ulBwp->srs_Config->choice.setup = NULLP;
+   CU_ALLOC(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
+   if(!ulBwp->srs_Config->choice.setup)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildInitialUlBWP");
+      return RFAILED;
+   }
+
+   if(BuildBWPUlDedSrsCfg(ulBwp->srs_Config->choice.setup) != ROK)
+   {
+      return RFAILED;   
+   }
+
+       ulBwp->beamFailureRecoveryConfig = NULLP;
+   
+   return ROK;
+}
+
+/*******************************************************************
+*
+* @brief Builds Pusch Serving cell Config
+*
+* @details
+*
+*    Function : BuildPuschSrvCellCfg
+*
+*    Functionality: Builds Pusch Serving cell Config
+*
+* @params[in] struct UplinkConfig__pusch_ServingCellConfig *puschCfg
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t BuildPuschSrvCellCfg(struct UplinkConfig__pusch_ServingCellConfig *puschCfg)
+{
+   puschCfg->present = UplinkConfig__pusch_ServingCellConfig_PR_setup;
+   puschCfg->choice.setup = NULLP;
+   CU_ALLOC(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
+   if(!puschCfg->choice.setup)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildPuschSrvCellCfg");
+      return RFAILED;
+   }
+
+   puschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
+       puschCfg->choice.setup->rateMatching = NULLP;
+       puschCfg->choice.setup->xOverhead = NULLP;
+   puschCfg->choice.setup->ext1 = NULLP;
+   CU_ALLOC(puschCfg->choice.setup->ext1, sizeof(struct PUSCH_ServingCellConfig__ext1));
+   if(!puschCfg->choice.setup->ext1)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildPuschSrvCellCfg");
+      return RFAILED;
+   }
+
+   puschCfg->choice.setup->ext1->maxMIMO_Layers = NULLP;
+   CU_ALLOC(puschCfg->choice.setup->ext1->maxMIMO_Layers, sizeof(long));
+   if(!puschCfg->choice.setup->ext1->maxMIMO_Layers)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildPuschSrvCellCfg");
+      return RFAILED;
+   }
+   *(puschCfg->choice.setup->ext1->maxMIMO_Layers) = PUSCH_MAX_MIMO_LAYERS;
+
+   puschCfg->choice.setup->ext1->processingType2Enabled= NULLP;
+   CU_ALLOC(puschCfg->choice.setup->ext1->processingType2Enabled,sizeof(BOOLEAN_t));
+   if(!puschCfg->choice.setup->ext1->processingType2Enabled)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildPuschSrvCellCfg");
+      return RFAILED;
+   }
+   *(puschCfg->choice.setup->ext1->processingType2Enabled) = PUSCH_PROCESS_TYPE2_ENABLED;
+   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)
+{
+   ulCfg->initialUplinkBWP = NULLP;
+   CU_ALLOC(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
+       if(!ulCfg->initialUplinkBWP)
+       {
+          DU_LOG("\nF1AP : Memory Allocation failed in BuildUlCfg");
+               return RFAILED;
+       }
+
+   if(BuildInitialUlBWP(ulCfg->initialUplinkBWP) != ROK)
+       {
+          return RFAILED;
+       }
+
+   ulCfg->uplinkBWP_ToReleaseList = NULLP;
+       ulCfg->uplinkBWP_ToAddModList = NULLP;
+       ulCfg->firstActiveUplinkBWP_Id = NULLP;
+   CU_ALLOC(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
+   if(!ulCfg->firstActiveUplinkBWP_Id)
+   {
+      DU_LOG("\nF1AP : Memory Allocation failed in BuildUlCfg");
+      return RFAILED;
+   }
+   *(ulCfg->firstActiveUplinkBWP_Id) = ACTIVE_UL_BWP_ID;
+
+   ulCfg->pusch_ServingCellConfig = NULLP;
+   CU_ALLOC(ulCfg->pusch_ServingCellConfig, \
+      sizeof(struct UplinkConfig__pusch_ServingCellConfig));
+   if(!ulCfg->pusch_ServingCellConfig)
+   {
+      DU_LOG("\nF1AP : Memory Allocation failed in BuildUlCfg");
+      return RFAILED;
+   }
+
+   if(BuildPuschSrvCellCfg(ulCfg->pusch_ServingCellConfig) != ROK)
+   {
+      return RFAILED;
+   }
+   
+       ulCfg->carrierSwitching = NULLP;
+       ulCfg->ext1 = NULLP;
+       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)
+{
+   pdschCfg->present =  ServingCellConfig__pdsch_ServingCellConfig_PR_setup;
+   pdschCfg->choice.setup = NULLP;
+   CU_ALLOC(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig));
+   if(!pdschCfg->choice.setup)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+      return RFAILED;
+   }
+
+   pdschCfg->choice.setup->codeBlockGroupTransmission = NULLP;
+       pdschCfg->choice.setup->xOverhead = NULLP;
+   pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH = NULLP;
+   CU_ALLOC(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH, sizeof(long));
+   if(!pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in BuildPdschSrvCellCfg");
+      return RFAILED;
+   }
+   *(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH)= PDSCH_NUM_HARQ_PROC;
+       pdschCfg->choice.setup->pucch_Cell = NULLP;
+       pdschCfg->choice.setup->ext1 = NULLP;
+
+   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->tdd_UL_DL_ConfigurationDedicated = NULLP;
+
+   srvCellCfg->initialDownlinkBWP = NULLP;
+   CU_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->downlinkBWP_ToReleaseList = NULLP;
+       srvCellCfg->downlinkBWP_ToAddModList = NULLP;
+
+   srvCellCfg->firstActiveDownlinkBWP_Id = NULLP;
+       CU_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->bwp_InactivityTimer = NULLP;
+
+   srvCellCfg->defaultDownlinkBWP_Id = NULLP;
+       CU_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;
+   CU_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->supplementaryUplink = NULLP;
+       srvCellCfg->pdcch_ServingCellConfig = NULLP;
+
+   srvCellCfg->pdsch_ServingCellConfig = NULLP;
+       CU_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;
+#if 0
+       CU_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;
+       }
+#endif
+   srvCellCfg->sCellDeactivationTimer = NULLP;
+       srvCellCfg->crossCarrierSchedulingConfig = NULLP;
+       srvCellCfg->tag_Id = TAG_ID;
+   srvCellCfg->dummy = NULLP;
+   srvCellCfg->pathlossReferenceLinking = NULLP;
+   srvCellCfg->servingCellMO = NULLP;
+   srvCellCfg->ext1 = NULLP;
+
+       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;
+       CU_ALLOC(spCellCfg->servCellIndex, sizeof(long));
+       if(!spCellCfg->servCellIndex)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildSpCellCfg");
+               return RFAILED;
+       }
+   *(spCellCfg->servCellIndex) = SERV_CELL_IDX;
+
+   spCellCfg->reconfigurationWithSync = NULLP;
+       spCellCfg->rlf_TimersAndConstants = NULLP;
+   spCellCfg->rlmInSyncOutOfSyncThreshold = NULLP;
+       CU_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;
+   CU_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->harq_ACK_SpatialBundlingPUCCH = NULLP;
+       phyCellGrpCfg->harq_ACK_SpatialBundlingPUSCH = NULLP;
+
+   phyCellGrpCfg->p_NR_FR1 = NULLP;
+       CU_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;
+       phyCellGrpCfg->tpc_SRS_RNTI = NULLP;
+       phyCellGrpCfg->tpc_PUCCH_RNTI = NULLP;
+       phyCellGrpCfg->tpc_PUSCH_RNTI = NULLP;
+       phyCellGrpCfg->sp_CSI_RNTI = NULLP;
+       phyCellGrpCfg->cs_RNTI = NULLP;
+       phyCellGrpCfg->ext1 = NULLP;
+       phyCellGrpCfg->ext2 = NULLP;
+
+       return ROK;
+}
+
+/*******************************************************************
+*
+* @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)
+{
+       struct TAG_Config__tag_ToAddModList *tagList;
+   uint8_t                     idx, elementCnt;
+
+   tagConfig->tag_ToReleaseList = NULLP;
+   tagConfig->tag_ToAddModList = NULLP;
+   CU_ALLOC(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
+       if(!tagConfig->tag_ToAddModList)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildTagConfig");
+               return RFAILED;
+       }
+
+       elementCnt = 1; //ODU_VALUE_ONE;
+       tagList = tagConfig->tag_ToAddModList;
+       tagList->list.count = elementCnt;
+       tagList->list.size  =  elementCnt * sizeof(struct TAG *);
+
+   tagList->list.array = NULLP;
+       CU_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<tagList->list.count; idx++)
+       {
+          tagList->list.array[idx] = NULLP;
+               CU_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;
+       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;
+       CU_ALLOC(phrConfig->choice.setup, sizeof(struct PHR_Config));
+       if(!phrConfig->choice.setup)
+       {
+               DU_LOG("\nF1AP : Memory allocation failure in BuildPhrConfig");
+               return RFAILED;
+       }
+
+       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 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;
+       bsrConfig->logicalChannelSR_DelayTimer = NULLP;
+
+   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;
+       CU_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(struct SchedulingRequestToAddMod *);
+
+   schReqList->list.array = NULLP;
+   CU_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;
+               CU_ALLOC(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
+               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;
+       CU_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;
+       schedulingRequestConfig->schedulingRequestToReleaseList = NULLP;
+
+       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->drx_Config = NULLP;
+   macCellGrpCfg->schedulingRequestConfig = NULLP;
+       CU_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;
+   CU_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;
+   CU_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;
+   CU_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;
+       macCellGrpCfg->ext1 = NULLP;
+
+       return ROK;
+}
+ /*******************************************************************
+ *
+ * @brief Frees memeory allocated for SearchSpcToAddModList
+ *
+ * @details
+ *
+ *    Function : FreeSearchSpcToAddModList
+ *
+ *    Functionality: Deallocating memory of SearchSpcToAddModList
+ *
+ * @params[in] struct PDCCH_Config__searchSpacesToAddModList *searchSpcList
+ *
+ * @return void
+ *
+ 4221 * ****************************************************************/
+void FreeSearchSpcToAddModList(struct PDCCH_Config__searchSpacesToAddModList *searchSpcList)
+{
+    uint8_t idx1=0;
+    uint8_t idx2=0;
+    struct  SearchSpace *searchSpc=NULLP;
+
+    if(searchSpcList->list.array)
+        {
+           if(searchSpcList->list.array[idx2])
+           {
+          searchSpc = searchSpcList->list.array[idx2];
+              if(searchSpc->controlResourceSetId)
+              {
+                 if(searchSpc->monitoringSlotPeriodicityAndOffset)
+                 {
+                    if(searchSpc->monitoringSymbolsWithinSlot)
+                    {
+                       if(searchSpc->monitoringSymbolsWithinSlot->buf)
+                       {
+                          if(searchSpc->nrofCandidates)
+                          {
+                             if(searchSpc->searchSpaceType)
+                             {
+                                CU_FREE(searchSpc->searchSpaceType->choice.ue_Specific,\
+                                sizeof(struct SearchSpace__searchSpaceType__ue_Specific));
+                                CU_FREE(searchSpc->searchSpaceType, sizeof(struct
+                                                                        SearchSpace__searchSpaceType));
+                             }
+                             CU_FREE(searchSpc->nrofCandidates,
+                             sizeof(struct SearchSpace__nrofCandidates));
+                          }
+                          CU_FREE(searchSpc->monitoringSymbolsWithinSlot->buf, \
+                          searchSpc->monitoringSymbolsWithinSlot->size);
+                       }
+                       CU_FREE(searchSpc->monitoringSymbolsWithinSlot,
+                       sizeof(BIT_STRING_t));
+                    }
+                    CU_FREE(searchSpc->monitoringSlotPeriodicityAndOffset, \
+                    sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset));
+                 }
+                 CU_FREE(searchSpc->controlResourceSetId,
+                 sizeof(ControlResourceSetId_t));
+                    }
+                 }
+                 for(idx1 = 0; idx1 < searchSpcList->list.count; idx1++)
+            {
+                CU_FREE(searchSpcList->list.array[idx1],
+                               sizeof(struct SearchSpace));
+                 }
+                 CU_FREE(searchSpcList->list.array,searchSpcList->list.size);
+        }
+}
+ /*******************************************************************
+ *
+ * @brief Frees memory allocated for PdschTimeDomAllocList
+ *
+ * @details
+ *
+ *    Function : FreePdschTimeDomAllocList
+ *
+ *    Functionality: Deallocating memory of PdschTimeDomAllocList
+ *
+ * @params[in] struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList
+ *
+ * @return void
+ *
+ 4221 * ****************************************************************/
+void FreePdschTimeDomAllocList( struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList)
+{
+   uint8_t idx1=0;
+       
+       if(timeDomAllocList->choice.setup)
+   {
+      if(timeDomAllocList->choice.setup->list.array)
+      {
+          for(idx1 = 0; idx1 <timeDomAllocList->choice.setup->list.count ; idx1++)
+          {
+             CU_FREE(timeDomAllocList->choice.setup->list.array[idx1],
+             sizeof(struct PDSCH_TimeDomainResourceAllocation));
+          }
+          CU_FREE(timeDomAllocList->choice.setup->list.array, \
+          timeDomAllocList->choice.setup->list.size);
+      }
+      CU_FREE(timeDomAllocList->choice.setup,\
+      sizeof(struct PDSCH_TimeDomainResourceAllocationList));
+   }
+}
+ /*******************************************************************
+ *
+ * @brief Frees memory allocated for PuschTimeDomAllocList
+ *
+ *@details
+ *
+ *    Function : FreePuschTimeDomAllocList
+ *
+ *    Functionality: Deallocating memory of PuschTimeDomAllocList
+ *
+ * @params[in] PUSCH_Config_t *puschCfg
+ *
+ * @return void
+ *
+ ***********************************************************************/
+void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg)
+{
+    uint8_t idx1=0;
+        uint8_t idx2=0;
+    struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList_t=NULLP;
+
+    if(puschCfg->pusch_TimeDomainAllocationList)
+    {
+       timeDomAllocList_t=puschCfg->pusch_TimeDomainAllocationList;
+       if(timeDomAllocList_t->choice.setup)
+       {
+          if(timeDomAllocList_t->choice.setup->list.array)
+          {
+             CU_FREE(timeDomAllocList_t->choice.setup->list.array[idx2]->k2, sizeof(long));
+             for(idx1 = 0; idx1<timeDomAllocList_t->choice.setup->list.count; idx1++)
+             {
+                CU_FREE(timeDomAllocList_t->choice.setup->list.array[idx1],\
+                                   sizeof(PUSCH_TimeDomainResourceAllocation_t));
+                                }
+                                CU_FREE(timeDomAllocList_t->choice.setup->list.array, \
+             timeDomAllocList_t->choice.setup->list.size);
+          }
+          CU_FREE(timeDomAllocList_t->choice.setup, \
+              sizeof(struct PUSCH_TimeDomainResourceAllocationList));
+       }
+                CU_FREE(puschCfg->transformPrecoder, sizeof(long));
+       CU_FREE(puschCfg->pusch_TimeDomainAllocationList, \
+                sizeof(struct PUSCH_Config__pusch_TimeDomainAllocationList));
+    }
+
+}
+ /*******************************************************************
+ *
+ * @brief Frees memory allocated for InitialUlBWP
+ *
+ * @details
+ *
+ *    Function : FreeInitialUlBWP
+ *
+ *    Functionality: Deallocating memory of InitialUlBWP
+ *
+ * @params[in] BWP_UplinkDedicated_t *ulBwp
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void FreeInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
+{
+    uint8_t  rSetIdx, rsrcIdx;
+    SRS_Config_t   *srsCfg = NULLP;
+    PUSCH_Config_t *puschCfg = NULLP;
+    struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA *dmrsUlCfg = NULLP;
+        struct SRS_Config__srs_ResourceSetToAddModList *rsrcSetList = NULLP;
+        struct SRS_ResourceSet__srs_ResourceIdList *rsrcIdList = NULLP;
+        struct SRS_Config__srs_ResourceToAddModList *resourceList = NULLP;
+
+        if(ulBwp->pusch_Config)
+    {
+       if(ulBwp->pusch_Config->choice.setup)
+       {
+          puschCfg=ulBwp->pusch_Config->choice.setup;
+          if(puschCfg->dataScramblingIdentityPUSCH)
+          {
+             if(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA)
+             {
+                FreePuschTimeDomAllocList(puschCfg);
+                dmrsUlCfg=puschCfg->dmrs_UplinkForPUSCH_MappingTypeA;
+                                        if(dmrsUlCfg->choice.setup)
+                {
+                   if(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition)
+                   {
+                      if(dmrsUlCfg->choice.setup->transformPrecodingDisabled)
+                      {
+                         CU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled->scramblingID0,\
+                                                                sizeof(long));
+                                                                CU_FREE(dmrsUlCfg->choice.setup->transformPrecodingDisabled,
+                         sizeof(struct DMRS_UplinkConfig__transformPrecodingDisabled));
+                                                        }
+                                                        CU_FREE(dmrsUlCfg->choice.setup->dmrs_AdditionalPosition,
+                                                        sizeof(long));
+                                                }
+                                                CU_FREE(dmrsUlCfg->choice.setup,sizeof(DMRS_UplinkConfig_t));
+                }
+                                        CU_FREE(puschCfg->dmrs_UplinkForPUSCH_MappingTypeA, \
+                                        sizeof(struct PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA));
+                                }
+             CU_FREE(puschCfg->dataScramblingIdentityPUSCH, sizeof(long));
+          }
+          CU_FREE(ulBwp->pusch_Config->choice.setup, sizeof(PUSCH_Config_t));
+           }
+                CU_FREE(ulBwp->pusch_Config, sizeof(struct BWP_UplinkDedicated__pusch_Config));
+
+                /* Free SRS-Config */
+                if(ulBwp->srs_Config)
+                {
+                   if(ulBwp->srs_Config->choice.setup)
+                        {
+                           srsCfg = ulBwp->srs_Config->choice.setup;
+
+                                /* Free Resource Set to add/mod list */
+                           if(srsCfg->srs_ResourceSetToAddModList)
+                                {
+                                   rsrcSetList = srsCfg->srs_ResourceSetToAddModList;
+                                        if(rsrcSetList->list.array)
+                                        {
+                                           rSetIdx = 0;
+
+                                                /* Free SRS resource Id list in this SRS resource set */
+                                                if(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList)
+                                                {
+                                                   rsrcIdList = rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList;
+
+                                                   if(rsrcIdList->list.array)
+                                                        {
+                                                           for(rsrcIdx = 0; rsrcIdx < rsrcIdList->list.count; rsrcIdx++)
+                                                                {
+                                                                   CU_FREE(rsrcIdList->list.array[rsrcIdx], sizeof(SRS_ResourceId_t));
+                                                           }
+                                                           CU_FREE(rsrcIdList->list.array, rsrcIdList->list.size);
+                                                        }
+                                                   CU_FREE(rsrcSetList->list.array[rSetIdx]->srs_ResourceIdList,\
+                                                           sizeof(struct SRS_ResourceSet__srs_ResourceIdList));
+                                                }
+
+                                                /* Free resource type info for this SRS resource set */
+                                                CU_FREE(rsrcSetList->list.array[rSetIdx]->resourceType.choice.aperiodic, \
+                                                   sizeof(struct SRS_ResourceSet__resourceType__aperiodic));
+
+                                                /* Free memory for each resource set */
+                                           for(rSetIdx = 0; rSetIdx < rsrcSetList->list.count; rSetIdx++)
+                                                {
+                                                   CU_FREE(rsrcSetList->list.array[rSetIdx], sizeof(SRS_ResourceSet_t));
+                                                }
+                                           CU_FREE(rsrcSetList->list.array, rsrcSetList->list.size); 
+                                        }
+                                   CU_FREE(srsCfg->srs_ResourceSetToAddModList, \
+                                           sizeof(struct SRS_Config__srs_ResourceSetToAddModList));
+                                }
+
+                                /* Free resource to add/modd list */
+                                if(srsCfg->srs_ResourceToAddModList)
+                                {
+                                   resourceList = srsCfg->srs_ResourceToAddModList;
+                                        if(resourceList->list.array)
+                                        {
+                                           rsrcIdx = 0;
+                                                CU_FREE(resourceList->list.array[rsrcIdx]->transmissionComb.choice.n2,\
+                                                   sizeof(struct SRS_Resource__transmissionComb__n2));
+                                           CU_FREE(resourceList->list.array[rsrcIdx]->resourceType.choice.aperiodic,\
+                                                   sizeof(struct SRS_Resource__resourceType__aperiodic));
+
+                                           for(rsrcIdx = 0; rsrcIdx < resourceList->list.count; rsrcIdx++)
+                                                {
+                                                   CU_FREE(resourceList->list.array[rsrcIdx], sizeof(SRS_Resource_t));
+                   }
+                                           CU_FREE(resourceList->list.array, resourceList->list.size);
+                                        }
+                                   CU_FREE(srsCfg->srs_ResourceToAddModList, \
+                                           sizeof(struct SRS_Config__srs_ResourceToAddModList));
+                                }
+
+                           CU_FREE(ulBwp->srs_Config->choice.setup, sizeof(SRS_Config_t));
+                        }
+                   CU_FREE(ulBwp->srs_Config, sizeof(struct BWP_UplinkDedicated__srs_Config));
+       }
+        }
+}      
+ /*******************************************************************
+ *
+ * @brief Frees memory allocated for initialUplinkBWP
+ *
+ * @details
+ *
+ *    Function : FreeinitialUplinkBWP
+ *
+ *    Functionality: Deallocating memory of initialUplinkBWP
+ *
+ * @params[in] UplinkConfig_t *ulCfg
+ *
+ * @return void
+ *         
+ *
+ * ****************************************************************/
+void FreeinitialUplinkBWP(UplinkConfig_t *ulCfg)
+{
+   BWP_UplinkDedicated_t *ulBwp=NULLP; 
+   struct UplinkConfig__pusch_ServingCellConfig *puschCfg=NULLP;
+   
+       if(ulCfg->initialUplinkBWP)
+       {
+          ulBwp=ulCfg->initialUplinkBWP;
+          if(ulCfg->firstActiveUplinkBWP_Id)
+          {
+             if(ulCfg->pusch_ServingCellConfig)
+             {
+                puschCfg=ulCfg->pusch_ServingCellConfig;
+                if(puschCfg->choice.setup)
+                {
+                   if(puschCfg->choice.setup->ext1)
+                   {
+                       CU_FREE(puschCfg->choice.setup->ext1->\
+                                                processingType2Enabled,sizeof(BOOLEAN_t));
+                       CU_FREE(puschCfg->choice.setup->ext1->\
+                                                maxMIMO_Layers,sizeof(long));
+                                                CU_FREE(puschCfg->choice.setup->ext1, \
+                                                sizeof(struct PUSCH_ServingCellConfig__ext1));
+                                       }
+                   CU_FREE(puschCfg->choice.setup, sizeof(struct PUSCH_ServingCellConfig));
+                }
+                CU_FREE(ulCfg->pusch_ServingCellConfig, sizeof(struct UplinkConfig__pusch_ServingCellConfig));
+             }
+             CU_FREE(ulCfg->firstActiveUplinkBWP_Id, sizeof(BWP_Id_t));
+          }
+          FreeInitialUlBWP(ulBwp);
+          CU_FREE(ulCfg->initialUplinkBWP, sizeof(BWP_UplinkDedicated_t));
+       }
+}
+ /*******************************************************************
+ *
+ * @brief Frees emmory allocated for BWPDlDedPdschCfg
+ *
+ * @details
+ *
+ *    Function : FreeBWPDlDedPdschCfg
+ *
+ *    Functionality: Deallocating memory of BWPDlDedPdschCfg
+ *
+ * @params[in] BWP_DownlinkDedicated_t *dlBwp
+ *
+ * @return void
+ *
+ *
+ * ****************************************************************/
+void FreeBWPDlDedPdschCfg(BWP_DownlinkDedicated_t *dlBwp)
+{
+   struct PDSCH_Config *pdschCfg=NULLP;
+       struct PDSCH_Config__prb_BundlingType *prbBndlType=NULLP;
+   struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAllocList=NULLP;
+   struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA *dmrsDlCfg=NULLP;
+
+       if(dlBwp->pdsch_Config->choice.setup)
+   {
+      pdschCfg=dlBwp->pdsch_Config->choice.setup;
+      if(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
+      {
+          if(pdschCfg->pdsch_TimeDomainAllocationList)
+          {
+             timeDomAllocList=pdschCfg->pdsch_TimeDomainAllocationList;
+             if(pdschCfg->maxNrofCodeWordsScheduledByDCI)
+             {
+                prbBndlType=&pdschCfg->prb_BundlingType;
+                CU_FREE(prbBndlType->choice.staticBundling,\
+                sizeof(struct PDSCH_Config__prb_BundlingType__staticBundling));
+                CU_FREE(pdschCfg->maxNrofCodeWordsScheduledByDCI, sizeof(long));
+             }
+             FreePdschTimeDomAllocList(timeDomAllocList);
+             CU_FREE(pdschCfg->pdsch_TimeDomainAllocationList, \
+             sizeof(struct PDSCH_Config__pdsch_TimeDomainAllocationList));
+          }
+          dmrsDlCfg=pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA;
+          if(dmrsDlCfg->choice.setup)
+          {
+             CU_FREE(dmrsDlCfg->choice.setup->dmrs_AdditionalPosition,
+             sizeof(long));
+             CU_FREE(dmrsDlCfg->choice.setup, sizeof(struct DMRS_DownlinkConfig));
+          }
+          CU_FREE(pdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA, \
+          sizeof(struct PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA));
+       }
+       CU_FREE(dlBwp->pdsch_Config->choice.setup, sizeof(struct PDSCH_Config));
+    }
+}
+ /*******************************************************************
+ *
+ * @brief Frees emmory allocated for BWPDlDedPdcchCfg
+ *
+ * @details
+ *
+ *    Function : FreeBWPDlDedPdcchCfg
+ *
+ *    Functionality: Deallocating memory of BWPDlDedPdcchCfg
+ *
+ * @params[in] BWP_DownlinkDedicated_t *dlBwp
+ *
+ * @return void
+ *         
+ *
+ * ****************************************************************/
+void FreeBWPDlDedPdcchCfg(BWP_DownlinkDedicated_t *dlBwp)
+{
+   uint8_t idx1=0;
+       uint8_t idx2=0;
+       struct PDCCH_Config *pdcchCfg=NULLP;
+   struct ControlResourceSet *controlRSet=NULLP;
+       struct PDCCH_Config__controlResourceSetToAddModList *controlRSetList=NULLP;
+
+       if(dlBwp->pdcch_Config->choice.setup)
+   {
+      pdcchCfg=dlBwp->pdcch_Config->choice.setup;
+      if(pdcchCfg->controlResourceSetToAddModList)
+      {
+         controlRSetList = pdcchCfg->controlResourceSetToAddModList;
+         if(controlRSetList->list.array)
+         {
+            controlRSet = controlRSetList->list.array[idx2];
+            if(controlRSet)
+            {
+               if(controlRSet->frequencyDomainResources.buf)
+               {
+                  if(controlRSet->pdcch_DMRS_ScramblingID)
+                  {
+                     if(pdcchCfg->searchSpacesToAddModList)
+                     {
+                         FreeSearchSpcToAddModList(pdcchCfg->searchSpacesToAddModList);
+                         CU_FREE(pdcchCfg->searchSpacesToAddModList, \
+                         sizeof(struct PDCCH_Config__searchSpacesToAddModList));
+                     }
+                     CU_FREE(controlRSet->pdcch_DMRS_ScramblingID, sizeof(long));
+                  }
+                                               CU_FREE(controlRSet->frequencyDomainResources.buf, \
+                                               controlRSet->frequencyDomainResources.size);
+                                       }
+                               }
+            for(idx1 = 0; idx1 <controlRSetList->list.count; idx1++)
+            {
+               CU_FREE(controlRSetList->list.array[idx1], sizeof(struct ControlResourceSet));
+            }
+                               CU_FREE(controlRSetList->list.array, controlRSetList->list.size);
+                       }
+                       CU_FREE(pdcchCfg->controlResourceSetToAddModList, \
+                       sizeof(struct PDCCH_Config__controlResourceSetToAddModList));
+               }
+               CU_FREE(dlBwp->pdcch_Config->choice.setup, sizeof(struct PDCCH_Config));
+       }
+}
+/*******************************************************************
+*
+* @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;
+   CU_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;
+   CU_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;
+   CU_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;
+   CU_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->allowedServingCells = NULLP;
+       macLcConfig->ul_SpecificParameters->allowedSCS_List = NULLP;
+       macLcConfig->ul_SpecificParameters->maxPUSCH_Duration = NULLP;
+   macLcConfig->ul_SpecificParameters->configuredGrantType1Allowed = NULLP;
+
+   macLcConfig->ul_SpecificParameters->logicalChannelGroup = NULLP;
+   CU_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;
+       CU_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;
+       macLcConfig->ul_SpecificParameters->bitRateQueryProhibitTimer = NULLP;
+
+   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;
+       CU_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;
+               CU_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;
+
+       CU_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]->reestablishRLC = NULLP;
+   rlcBearerList->list.array[idx]->rlc_Config = NULLP;
+   CU_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;
+   CU_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 Free memory allocated for CellGroupConfig 
+ *
+ * @details
+ *
+ *    Function : FreeMemCellGrpCfg
+ *
+ *    Functionality: Deallocating memory of CellGroupConfig
+ *
+ * @params[in] pointer to CellGroupConfigRrc_t
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ ******************************************************************/
+uint8_t FreeMemCellGrpCfg(CellGroupConfigRrc_t *cellGrpCfg)
+{
+   uint8_t idx=0;
+   SpCellConfig_t *spCellCfg=NULLP;
+   ServingCellConfig_t *srvCellCfg=NULLP;
+   BWP_DownlinkDedicated_t *dlBwp=NULLP;
+   MAC_CellGroupConfig_t *macCellGrpCfg=NULLP;
+   PhysicalCellGroupConfig_t *phyCellGrpCfg=NULLP;
+   struct CellGroupConfigRrc__rlc_BearerToAddModList *rlcBearerList=NULLP;
+   struct RLC_Config *rlcConfig=NULLP;
+   struct LogicalChannelConfig *macLcConfig=NULLP;
+   struct SchedulingRequestConfig *schedulingRequestConfig=NULLP;
+   struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqList=NULLP;
+   struct TAG_Config *tagConfig=NULLP;
+   struct TAG_Config__tag_ToAddModList *tagList=NULLP;
+   struct MAC_CellGroupConfig__phr_Config *phrConfig=NULLP;
+   struct ServingCellConfig__pdsch_ServingCellConfig *pdschCfg=NULLP;
+
+   rlcBearerList = cellGrpCfg->rlc_BearerToAddModList;
+   if(rlcBearerList)
+   {
+      if(rlcBearerList->list.array)
+      {
+        for(idx=0; idx<rlcBearerList->list.count; idx++)
+        {
+           if(rlcBearerList->list.array[idx])
+           {  
+              rlcConfig   = rlcBearerList->list.array[idx]->rlc_Config;
+              macLcConfig = rlcBearerList->list.array[idx]->mac_LogicalChannelConfig;
+              if(rlcConfig)
+              {
+                 if(rlcConfig->choice.am)
+                 {
+                    CU_FREE(rlcConfig->choice.am->ul_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t));
+                    CU_FREE(rlcConfig->choice.am->dl_AM_RLC.sn_FieldLength, sizeof(SN_FieldLengthAM_t)); 
+                    CU_FREE(rlcConfig->choice.am, sizeof(struct RLC_Config__am));
+                 }     
+                 CU_FREE(rlcConfig, sizeof(struct RLC_Config));
+              }
+              CU_FREE(rlcBearerList->list.array[idx]->servedRadioBearer, sizeof(struct RLC_BearerConfig__servedRadioBearer));
+              if(macLcConfig)
+              {
+                 if(macLcConfig->ul_SpecificParameters)
+                 {
+                    CU_FREE(macLcConfig->ul_SpecificParameters->schedulingRequestID,   sizeof(SchedulingRequestId_t));
+                    CU_FREE(macLcConfig->ul_SpecificParameters->logicalChannelGroup,   sizeof(long));
+                    CU_FREE(macLcConfig->ul_SpecificParameters, sizeof(struct LogicalChannelConfig__ul_SpecificParameters));
+                 }
+                 CU_FREE(rlcBearerList->list.array[idx]->mac_LogicalChannelConfig, sizeof(struct LogicalChannelConfig));
+              }
+              CU_FREE(rlcBearerList->list.array[idx], sizeof(struct RLC_BearerConfig));
+           }   
+        }
+        CU_FREE(rlcBearerList->list.array, rlcBearerList->list.size);
+      }
+      CU_FREE(cellGrpCfg->rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
+   }
+
+   macCellGrpCfg = cellGrpCfg->mac_CellGroupConfig;
+   if(macCellGrpCfg)
+   {
+      schedulingRequestConfig = macCellGrpCfg->schedulingRequestConfig; 
+      if(schedulingRequestConfig)
+      {
+        schReqList = schedulingRequestConfig->schedulingRequestToAddModList;
+        if(schReqList)
+        {
+           if(schReqList->list.array)
+           {
+              for(idx=0;idx<schReqList->list.count; idx++)
+              {
+                 if(schReqList->list.array[idx])
+                 {
+                    CU_FREE(schReqList->list.array[idx]->sr_ProhibitTimer, sizeof(long));
+                    CU_FREE(schReqList->list.array[idx], sizeof(struct SchedulingRequestToAddMod));
+                 }
+              }
+              CU_FREE(schReqList->list.array, schReqList->list.size);
+           }
+           CU_FREE(schedulingRequestConfig->schedulingRequestToAddModList,\
+                 sizeof(struct SchedulingRequestConfig__schedulingRequestToAddModList));    }
+           CU_FREE(macCellGrpCfg->schedulingRequestConfig, sizeof(struct SchedulingRequestConfig));
+      }
+      if(macCellGrpCfg->bsr_Config)
+      {
+        CU_FREE(macCellGrpCfg->bsr_Config, sizeof(struct BSR_Config));
+      }
+      tagConfig = macCellGrpCfg->tag_Config;
+      if(tagConfig)
+      {
+        tagList = tagConfig->tag_ToAddModList;
+        if(tagList)
+        {
+           if(tagList->list.array)
+           {
+              for(idx=0; idx<tagList->list.count; idx++)
+              {
+                 CU_FREE(tagList->list.array[idx], sizeof(struct TAG));
+              }
+              CU_FREE(tagList->list.array, tagList->list.size);
+           }
+           CU_FREE(tagConfig->tag_ToAddModList, sizeof(struct TAG_Config__tag_ToAddModList));
+        }
+        CU_FREE(tagConfig, sizeof(struct TAG_Config));
+      }
+
+      phrConfig = macCellGrpCfg->phr_Config;
+      if(phrConfig)
+      {
+        CU_FREE(phrConfig->choice.setup, sizeof(struct PHR_Config));
+        CU_FREE(phrConfig, sizeof(struct MAC_CellGroupConfig__phr_Config));
+      }
+
+      CU_FREE(macCellGrpCfg, sizeof(MAC_CellGroupConfig_t));
+   }
+
+   phyCellGrpCfg = cellGrpCfg->physicalCellGroupConfig;
+   if(phyCellGrpCfg)
+   {
+      CU_FREE(phyCellGrpCfg->p_NR_FR1, sizeof(long));
+      CU_FREE(phyCellGrpCfg, sizeof(PhysicalCellGroupConfig_t));
+   }
+
+   spCellCfg = cellGrpCfg->spCellConfig;
+   if(spCellCfg)
+   {
+      if(spCellCfg->servCellIndex)
+      {
+        if(spCellCfg->rlmInSyncOutOfSyncThreshold)
+        {
+           if(spCellCfg->spCellConfigDedicated)
+           {
+              srvCellCfg = spCellCfg->spCellConfigDedicated;
+              if(srvCellCfg->initialDownlinkBWP)
+              {
+                 dlBwp = srvCellCfg->initialDownlinkBWP;
+                 if(srvCellCfg->firstActiveDownlinkBWP_Id)
+                 {
+                    if(srvCellCfg->defaultDownlinkBWP_Id)
+                    {
+                       if(srvCellCfg->uplinkConfig)
+                       {
+                          if(srvCellCfg->pdsch_ServingCellConfig)
+                          {
+                             pdschCfg= srvCellCfg->pdsch_ServingCellConfig;
+                             if(pdschCfg->choice.setup)
+                             {
+                                CU_FREE(pdschCfg->choice.setup->nrofHARQ_ProcessesForPDSCH,sizeof(long));
+                                CU_FREE(pdschCfg->choice.setup, sizeof( struct PDSCH_ServingCellConfig));
+                             }
+                             CU_FREE(srvCellCfg->pdsch_ServingCellConfig, sizeof(struct
+                                      ServingCellConfig__pdsch_ServingCellConfig));
+                          }
+                          FreeinitialUplinkBWP(srvCellCfg->uplinkConfig);
+                          CU_FREE(srvCellCfg->uplinkConfig, sizeof(UplinkConfig_t));   
+                       }
+                       CU_FREE(srvCellCfg->defaultDownlinkBWP_Id, sizeof(long));
+                    }
+                    CU_FREE(srvCellCfg->firstActiveDownlinkBWP_Id, sizeof(long));
+                 }
+                 if(dlBwp->pdcch_Config)
+                 {
+                    if(dlBwp->pdsch_Config)
+                    {
+                       FreeBWPDlDedPdschCfg(dlBwp);
+                       CU_FREE(dlBwp->pdsch_Config, sizeof(struct BWP_DownlinkDedicated__pdsch_Config));
+                    }
+                    FreeBWPDlDedPdcchCfg(dlBwp);
+                    CU_FREE(dlBwp->pdcch_Config, sizeof(struct BWP_DownlinkDedicated__pdcch_Config));
+                 }
+                 CU_FREE(srvCellCfg->initialDownlinkBWP, sizeof(BWP_DownlinkDedicated_t));
+              }
+              CU_FREE(spCellCfg->spCellConfigDedicated, sizeof(ServingCellConfig_t));
+           }
+           CU_FREE(spCellCfg->rlmInSyncOutOfSyncThreshold, sizeof(long));
+        }
+        CU_FREE(spCellCfg->servCellIndex, sizeof(long));
+      }
+      CU_FREE(spCellCfg,sizeof(SpCellConfig_t));
+   }
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills CellGroupConfig 
+ *
+ * @details
+ *
+ *    Function : fillCellGrpCfg
+ *
+ *    Functionality: Fills CellGroupConfig
+ *
+ * @params[in] pointer to CellGroupConfigRrc_t
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ ******************************************************************/
+
+uint8_t fillCellGrpCfg(CellGroupConfig_t *cellGrp)
+{
+   uint8_t               ret = RFAILED;
+   CellGroupConfigRrc_t  cellGrpCfg;
+   asn_enc_rval_t        encRetVal;
+
+   while(true)
+   {
+      cellGrpCfg.cellGroupId = CELL_GRP_ID;
+
+      cellGrpCfg.rlc_BearerToAddModList = NULLP;
+      CU_ALLOC(cellGrpCfg.rlc_BearerToAddModList, sizeof(struct CellGroupConfigRrc__rlc_BearerToAddModList));
+      if(!cellGrpCfg.rlc_BearerToAddModList)
+      {
+        DU_LOG("\nF1AP : Memory allocation failure in CellGrpConfig");
+        break;
+      }
+      if(BuildRlcBearerToAddModList(cellGrpCfg.rlc_BearerToAddModList) != ROK)
+      {
+        DU_LOG("\nF1AP : fillCellGrpCfg failed");
+        break;
+      }
+
+      cellGrpCfg.rlc_BearerToReleaseList = NULLP;
+      cellGrpCfg.mac_CellGroupConfig = NULLP;
+      CU_ALLOC(cellGrpCfg.mac_CellGroupConfig, sizeof(MAC_CellGroupConfig_t));
+      if(!cellGrpCfg.mac_CellGroupConfig)
+      {
+        DU_LOG("\nF1AP : Memory allocation failure in fillCellGrpCfg");
+        break;
+      }
+      if(BuildMacCellGrpCfg(cellGrpCfg.mac_CellGroupConfig) != ROK)
+      {
+        DU_LOG("\nF1AP : BuildMacCellGrpCfg failed");
+        break;
+      }
+
+
+      cellGrpCfg.physicalCellGroupConfig = NULLP;
+      CU_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;
+      CU_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;
+      }
+
+      cellGrpCfg.sCellToAddModList = NULLP;
+      cellGrpCfg.sCellToReleaseList = NULLP;
+      cellGrpCfg.ext1 = NULLP;
+
+      /* encode cellGrpCfg into duToCuRrcContainer */
+      xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, &cellGrpCfg);
+      cmMemset((uint8_t *)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]);
+        }
+      }
+
+      cellGrp->size = encBufSize;
+      CU_ALLOC(cellGrp->buf, cellGrp->size);
+      if(!cellGrp->buf)
+      {
+        DU_LOG("\nF1AP : Memory allocation failed in BuildDuToCuRrcContainer");
+        break;
+      }
+      memcpy(cellGrp->buf, encBuf, cellGrp->size);
+      ret = ROK;
+      break;
+   }
+   FreeMemCellGrpCfg(&cellGrpCfg);
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills CuToDuContainer 
+ *
+ * @details
+ *
+ *    Function : fillCuToDuContainer
+ *
+ *    Functionality: Fills CuToDuContainer
+ *
+ * @params[in] pointer to CUtoDURRCInformation_t
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ ******************************************************************/
+
+uint8_t fillCuToDuContainer(CUtoDURRCInformation_t *rrcMsg)
+{
+   uint8_t elementCnt = 0;
+   uint8_t ret = ROK;
+   uint8_t idx, idx2, rrcBufLen;
+
+   elementCnt = 1;
+   CU_ALLOC(rrcMsg->iE_Extensions, sizeof(ProtocolExtensionContainer_4624P16_t));
+   if(rrcMsg->iE_Extensions)
+   {
+      rrcMsg->iE_Extensions->list.count = elementCnt;
+      rrcMsg->iE_Extensions->list.size = elementCnt * sizeof(CUtoDURRCInformation_ExtIEs_t);
+
+      /* Initialize the CUtoDURRCInformation_ExtIEs */
+      CU_ALLOC(rrcMsg->iE_Extensions->list.array, rrcMsg->iE_Extensions->list.size);
+
+      if(rrcMsg->iE_Extensions->list.array == NULLP)
+      {
+         DU_LOG(" F1AP : Memory allocation for CUtoDURRCInformation_ExtIEs failed");
+         ret = RFAILED;
+      }
+
+      for(idx=0; idx<elementCnt; idx++)
+      {
+         CU_ALLOC(rrcMsg->iE_Extensions->list.array[idx], sizeof(CUtoDURRCInformation_ExtIEs_t));
+         if(rrcMsg->iE_Extensions->list.array[idx] == NULLP)
+         {
+            ret = RFAILED;
+         }
+      }
+      idx = 0;
+      /* Filling CellGroupConfig_t IE */
+      rrcMsg->iE_Extensions->list.array[idx]->id = ProtocolIE_ID_id_CellGroupConfig;
+      rrcMsg->iE_Extensions->list.array[idx]->criticality = Criticality_ignore; 
+      rrcMsg->iE_Extensions->list.array[idx]->extensionValue.present  =\
+      CUtoDURRCInformation_ExtIEs__extensionValue_PR_CellGroupConfig;
+      ret = fillCellGrpCfg(&rrcMsg->iE_Extensions->list.array[idx]->extensionValue.choice.CellGroupConfig);
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Free CuToDuContainer 
+ *
+ * @details
+ *
+ *    Function : FreeCuToDuInfo
+ *
+ *    Functionality: Free CuToDuContainer
+ *
+ * @params[in] pointer to CUtoDURRCInformation_t
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ ******************************************************************/
+
+void FreeCuToDuInfo(CUtoDURRCInformation_t *rrcMsg)
+{
+   uint8_t idx, idx2;
+
+   if(rrcMsg->iE_Extensions)
+   {
+      if(rrcMsg->iE_Extensions->list.array)
+      {
+         for(idx= 0; idx < rrcMsg->iE_Extensions->list.count; idx++)
+         {
+            if(rrcMsg->iE_Extensions->list.array[idx])
+           {
+              switch(rrcMsg->iE_Extensions->list.array[idx]->id)
+              {
+                  case ProtocolIE_ID_id_CellGroupConfig:
+                     if(rrcMsg->iE_Extensions->list.array[idx]->extensionValue.choice.CellGroupConfig.buf != NULLP)
+                    {
+                        CU_FREE(rrcMsg->iE_Extensions->list.array[idx]->extensionValue.choice.CellGroupConfig.buf,\
+                       rrcMsg->iE_Extensions->list.array[idx]->extensionValue.choice.CellGroupConfig.size);
+
+                    }
+                  break;
+                  default:
+                    DU_LOG("\nF1AP:Invalid Event type %ld at FreeCuToDuInfo()", \
+                       rrcMsg->iE_Extensions->list.array[idx]->id);
+                    break;
+              }
+           }
+           break;
+         }
+        for(idx2 = 0; idx2 < idx; idx2++)
+        {
+            CU_FREE(rrcMsg->iE_Extensions->list.array[idx2], sizeof(CUtoDURRCInformation_ExtIEs_t));
+        }
+         CU_FREE(rrcMsg->iE_Extensions->list.array, rrcMsg->iE_Extensions->list.size);
+
+      }
+
+      CU_FREE(rrcMsg->iE_Extensions, sizeof(ProtocolExtensionContainer_4624P16_t));
+   }
+}
+/*******************************************************************
+ *
+ * @brief Builds and sends the UE Setup Request 
+ *
+ * @details
+ *
+ *    Function : BuildAndSendUeContextSetupReq
+ *
+ *    Functionality: Constructs the UE Setup Request and sends
+ *                   it to the CU through SCTP.
+ *
+ * @params[in] 
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildAndSendUeContextSetupReq(uint8_t cuUeF1apId, uint8_t duUeF1apId, \
+   uint16_t rrcContLen, uint8_t *rrcContainer)
+{
+   uint8_t   Nrcgiret;
+   uint8_t   SplCellListret;
+   uint8_t   SrbSetupret;
+   uint8_t   elementCnt;
+   uint8_t   idx;
+   uint8_t   idx1;
+   F1AP_PDU_t          *f1apMsg = NULLP;
+   UEContextSetupRequest_t *ueSetReq = NULLP;
+   asn_enc_rval_t encRetVal;        /* Encoder return value */
+   memset(&encRetVal, 0, sizeof(asn_enc_rval_t));
+   uint8_t ret= RFAILED;
+   uint8_t ret1;
+   while(true)
+   {
+      DU_LOG("\n F1AP : Building UE Context Setup Request\n");
+
+      CU_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;
+      CU_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_UEContextSetup;
+      f1apMsg->choice.initiatingMessage->criticality = Criticality_reject;
+      f1apMsg->choice.initiatingMessage->value.present = \
+         InitiatingMessage__value_PR_UEContextSetupRequest;
+      ueSetReq =
+        &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
+
+      elementCnt = 11;
+      ueSetReq->protocolIEs.list.count = elementCnt;
+      ueSetReq->protocolIEs.list.size = \
+                                       elementCnt * sizeof(UEContextSetupRequestIEs_t *);
+
+      /* Initialize the UESetup members */
+      CU_ALLOC(ueSetReq->protocolIEs.list.array,ueSetReq->protocolIEs.list.size);
+
+      if(ueSetReq->protocolIEs.list.array == NULLP)
+      {
+        DU_LOG(" F1AP : Memory allocation for UE Context SetupRequest failed");
+        break;
+      }
+
+      for(idx1=0; idx1<elementCnt; idx1++)
+      {
+        CU_ALLOC(ueSetReq->protocolIEs.list.array[idx1],sizeof(UEContextSetupRequestIEs_t));
+        if(ueSetReq->protocolIEs.list.array[idx1] == NULLP)
+        {
+           break;
+        }
+      }
+
+      idx = 0;
+
+      /*GNB CU UE F1AP ID*/
+      ueSetReq->protocolIEs.list.array[idx]->id        = \
+                                                 ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
+      ueSetReq->protocolIEs.list.array[idx]->criticality       =       Criticality_reject;
       ueSetReq->protocolIEs.list.array[idx]->value.present = \
-                                                            UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation;
+                                                            UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
+      ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = cuUeF1apId;
+
+      /*GNB DU UE F1AP ID*/
+      idx++;
+      ueSetReq->protocolIEs.list.array[idx]->id        = \
+                                                 ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+      ueSetReq->protocolIEs.list.array[idx]->criticality       =       Criticality_ignore;
+      ueSetReq->protocolIEs.list.array[idx]->value.present = \
+                                                            UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
+      ueSetReq->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = duUeF1apId;
+
+      /*Special Cell ID*/
+      idx++;
+      ueSetReq->protocolIEs.list.array[idx]->id        = \
+                                                 ProtocolIE_ID_id_SpCell_ID;
+      ueSetReq->protocolIEs.list.array[idx]->criticality       =       Criticality_reject;
+      ueSetReq->protocolIEs.list.array[idx]->value.present = \
+                                                            UEContextSetupRequestIEs__value_PR_NRCGI;
+      Nrcgiret = BuildNrcgi(&ueSetReq->protocolIEs.list.array[idx]->value.choice.NRCGI);
+      if(Nrcgiret != ROK)
+      {
+        break;
+      }
+
+      /*Served Cell Index*/
+      idx++;
+      ueSetReq->protocolIEs.list.array[idx]->id        = \
+                                                 ProtocolIE_ID_id_ServCellIndex;
+      ueSetReq->protocolIEs.list.array[idx]->criticality       =       Criticality_reject;
+      ueSetReq->protocolIEs.list.array[idx]->value.present = \
+                                                            UEContextSetupRequestIEs__value_PR_ServCellIndex;
+      ueSetReq->protocolIEs.list.array[idx]->value.choice.ServCellIndex = \
+                                                                         CELL_INDEX;
+
+      /*CellULConfigured*/
+      idx++;
+      ueSetReq->protocolIEs.list.array[idx]->id        = \
+                                                 ProtocolIE_ID_id_SpCellULConfigured;
+      ueSetReq->protocolIEs.list.array[idx]->criticality       =       Criticality_ignore;
+      ueSetReq->protocolIEs.list.array[idx]->value.present = \
+                                                            UEContextSetupRequestIEs__value_PR_CellULConfigured;
+      ueSetReq->protocolIEs.list.array[idx]->value.choice.CellULConfigured = \
+                                                                            CellULConfigured_none;
 
+      /*CUtoDURRCContainer*/
+      idx++;
+      ueSetReq->protocolIEs.list.array[idx]->id        = \
+                                                 ProtocolIE_ID_id_CUtoDURRCInformation;
+      ueSetReq->protocolIEs.list.array[idx]->criticality       =       Criticality_reject;
+      ueSetReq->protocolIEs.list.array[idx]->value.present = \
+                                                            UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation;
+      if(fillCuToDuContainer(&ueSetReq->protocolIEs.list.array[idx]->value.choice.CUtoDURRCInformation))
+      {
+         break;
+      }
+      
       /*Special Cells to be SetupList*/
       idx++;
       ueSetReq->protocolIEs.list.array[idx]->id        = \
@@ -2849,7 +5868,7 @@ uint8_t BuildAndSendUESetReq(uint8_t cuUeF1apId, uint8_t duUeF1apId, \
           ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.size);
       if(!ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf)
       {
-         DU_LOG(" F1AP : Memory allocation for BuildAndSendUESetReq failed");
+         DU_LOG(" F1AP : Memory allocation for BuildAndSendUeContextSetupReq failed");
          break;
       }
       memcpy(ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCContainer.buf, \
@@ -2864,7 +5883,7 @@ uint8_t BuildAndSendUESetReq(uint8_t cuUeF1apId, uint8_t duUeF1apId, \
          UEContextSetupRequestIEs__value_PR_RRCDeliveryStatusRequest;
       ueSetReq->protocolIEs.list.array[idx]->value.choice.RRCDeliveryStatusRequest = \
          RRCDeliveryStatusRequest_true;
-
+      
       xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
 
       /* Encode the F1SetupRequest type as APER */
@@ -2897,10 +5916,26 @@ uint8_t BuildAndSendUESetReq(uint8_t cuUeF1apId, uint8_t duUeF1apId, \
       ret = ROK;
       break;
    }
-   FreeUESetReq(f1apMsg);
+   FreeUeContextSetupReq(f1apMsg);
 
    return ret;
-}/* End of BuildAndSendUESetReq*/
+}/* End of BuildAndSendUeContextSetupReq*/
+
+/****************************************************************
+ * @brief Function to process Ul Rrc Msg received from DU 
+ *
+ * @details
+ *
+ *    Function : procUlRrcMsg
+ *
+ *    Functionality:
+ *         - Function to process Ul Rrc Msg received from DU
+ *
+ * @params[in]
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
 
 uint8_t procUlRrcMsg(F1AP_PDU_t *f1apMsg)
 {
@@ -2955,7 +5990,7 @@ uint8_t procUlRrcMsg(F1AP_PDU_t *f1apMsg)
       rrcMsgType = setDlRRCMsgType();
       if(rrcMsgType == RRC_SECURITY_MODE_COMMAND)
       {
-         ret = BuildAndSendUESetReq(cuUeF1apId, duUeF1apId, rrcContLen, rrcContainer);
+         ret = BuildAndSendUeContextSetupReq(cuUeF1apId, duUeF1apId, rrcContLen, rrcContainer);
       }
       if(rrcMsgType == RRC_RECONFIG)
       {
@@ -3251,6 +6286,17 @@ void F1APMsgHdlr(Buffer *mBuf)
               DU_LOG("\nF1Reset Acknowledgement is received successfully ");
               break;
            }
+            case SuccessfulOutcome__value_PR_UEContextSetupResponse:
+           {
+               DU_LOG("\nF1AP : UE ContextSetupResponse received");
+               break;
+           }
+            default:
+            {
+               DU_LOG("\nF1AP : Invalid type of successful outcome message [%d]",\
+                 f1apMsg->choice.successfulOutcome->value.present);
+               return;
+            }
         }/* End of switch(successfulOutcome) */
         break;
       } 
index 3d3a538..5840050 100644 (file)
@@ -25,7 +25,6 @@
 #include "du_app_mac_inf.h"
 #include "du_cfg.h"
 #include "du_app_rlc_inf.h"
-#include "E2AP-PDU.h"
 #include "du_mgr_main.h"
 #include "du_utils.h"
 #include "GNB-DU-System-Information.h"
@@ -51,6 +50,8 @@
 #include "PDCCH-Config.h"
 #include "PDSCH-TimeDomainResourceAllocation.h"
 #include "PDSCH-TimeDomainResourceAllocationList.h"
+#include "PDSCH-CodeBlockGroupTransmission.h"
+#include "PDSCH-ServingCellConfig.h"
 #include "DMRS-DownlinkConfig.h"
 #include "PDSCH-Config.h"
 #include "BWP-DownlinkDedicated.h"
@@ -65,8 +66,9 @@
 #include "BWP-UplinkDedicated.h"
 #include "PUSCH-ServingCellConfig.h"
 #include "UplinkConfig.h"
-#include "PDSCH-ServingCellConfig.h"
 #include "DUtoCURRCContainer.h"
+#include "GBR-QoSFlowInformation.h"
+#include "QoSFlowLevelQoSParameters.h"
 #include<ProtocolIE-Field.h>
 #include "ProtocolExtensionField.h"
 #include "F1AP-PDU.h"
@@ -81,7 +83,6 @@ uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg);
 void FreeDUConfigUpdate(F1AP_PDU_t *f1apDuCfg);
 uint8_t sctpSend(Buffer *mBuf, uint8_t itfType);
 uint8_t BuildInitialUlBWP(BWP_UplinkDedicated_t *ulBwp);
-uint8_t procUeContextSetupReq(F1AP_PDU_t *f1apMsg);
 
 /*******************************************************************
  *
@@ -2583,7 +2584,7 @@ uint8_t BuildRlcBearerToAddModList(struct CellGroupConfigRrc__rlc_BearerToAddMod
    coreset1StartPrb = coreset0EndPrb + 6;
    coreset1NumPrb = CORESET1_NUM_PRB;
    /* calculate the PRBs */
-   schAllocFreqDomRscType0(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
+   freqDomRscAllocType0(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
    memcpy(controlRSet->frequencyDomainResources.buf, freqDomainResource, FREQ_DOM_RSRC_SIZE);
    controlRSet->frequencyDomainResources.bits_unused = bitsUnused;
 
@@ -5240,184 +5241,2286 @@ uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti
       return RFAILED;
 }/* End of BuildAndSendInitialRrcMsgTransfer*/
 
+/*****  UE SETUP REQUEST *****/
+
 /*******************************************************************
  *
- * @brief Free the memory allocated for UE Setup response
+ * @brief Free Qos And Snssai Drb Info
  *
  * @details
  *
- *    Function : FreeUeSetupRsp
+ *    Function : freeDrbQosAndSnssaiInfo
  *
- *    Functionality:
- *       Free the memory allocated for UE Setup response
+ *    Functionality: Free Qos And Snssai Drb Info
  *
- * @params[in] F1AP PDU for UE setup response
- * @return ROK     - success
- *         RFAILED - failure
+ * @params[in] LcCfg *lcCfg,
+ * @return void
  *
  * ****************************************************************/
-void FreeUeSetupRsp(F1AP_PDU_t *f1apMsg)
+void freeDrbQosAndSnssaiInfo(LcCfg *lcCfg)
 {
-   uint8_t idx;
-   UEContextSetupResponse_t     *ueSetRsp;
+   if(lcCfg->snssai)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
+   }
+   if(lcCfg->drbQos)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
+   }
+}
 
-   if(f1apMsg)
+/******************************************************************
+*
+* @brief Function to delete the RLC Lc cfg from UE APP DB
+*
+* @details
+*
+*  Function : freeRlcLcCfg
+*
+*  Functionality: Function to delete the RLC Lc cfg from UE APP DB
+*
+*
+ *****************************************************************/
+
+void freeRlcLcCfg(RlcBearerCfg *lcCfg)
+{
+   switch(lcCfg->rlcMode)
    {
-      if(f1apMsg->choice.successfulOutcome)
+      case RLC_AM :
       {
-        ueSetRsp = &f1apMsg->choice.successfulOutcome->value.choice.\
-                   UEContextSetupResponse;
-        if(ueSetRsp->protocolIEs.list.array)
+         if(lcCfg->u.amCfg)
         {
-           for(idx = 0; idx < ueSetRsp->protocolIEs.list.size; idx++)
-           {
-              DU_FREE(ueSetRsp->protocolIEs.list.array[idx],\
-                    sizeof(UEContextSetupResponseIEs_t));
-           }
-           DU_FREE(ueSetRsp->protocolIEs.list.array, \
-                 ueSetRsp->protocolIEs.list.size);
+            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.amCfg, sizeof(AmBearerCfg));
+            lcCfg->u.amCfg = NULLP;
         }
-        DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
+         break;
       }
-      DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+      case RLC_UM_BI_DIRECTIONAL :
+      {
+         if(lcCfg->u.umBiDirCfg)
+        {
+            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
+           lcCfg->u.umBiDirCfg = NULLP;
+         }
+         break;
+      }
+      case RLC_UM_UNI_DIRECTIONAL_UL :
+      {
+         if(lcCfg->u.umUniDirUlCfg)
+        {
+            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
+           lcCfg->u.umUniDirUlCfg = NULLP;
+        }
+         break;
+
+      }
+      case RLC_UM_UNI_DIRECTIONAL_DL :
+      {
+         if(lcCfg->u.umUniDirDlCfg)
+        {
+            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
+           lcCfg->u.umUniDirDlCfg = NULLP;
+         }
+         break;
+      }
+      default:
+         DU_LOG("\nDU_APP: Invalid Rlc Mode %d at freeRlcLcCfg()", lcCfg->rlcMode);
+        break;
    }
+   memset(lcCfg, 0, sizeof(LcCfg));
 }
-
 /*******************************************************************
  *
- * @brief Builds and sends the UE Setup Response
+ * @brief Function to free MacLcCfg
  *
  * @details
  *
- *    Function : BuildAndSendUESetRsp
- *
- *    Functionality: Constructs the UE Setup Response and sends
- *                   it to the DU through SCTP.
+ *    Function : freeMacLcCfg
  *
- * @params[in] 
+ *    Functionality: Function to free MacLcCfg
  *
- * @return ROK     - success
- *         RFAILED - failure
+ * @params[in] LcCfg *lcCfg,
+ * @return void
  *
  * ****************************************************************/
-uint8_t BuildAndSendUESetRsp()
+
+void  freeMacLcCfg(LcCfg *lcCfg)
 {
-   uint8_t   ret = RFAILED;
-   uint8_t   elementCnt;
-   uint8_t   idx;
-   F1AP_PDU_t   *f1apMsg = NULL;
-   UEContextSetupResponse_t    *ueSetRsp;
-   asn_enc_rval_t  encRetVal;        /* Encoder return value */
+    /* Deleting DRBQOS */
+   if(lcCfg->drbQos)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
+      lcCfg->drbQos = NULLP;
+   }
+   /* Deleting SNSSAI */
+   if(lcCfg->snssai)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
+      lcCfg->snssai = NULLP;
+   }
+   memset(lcCfg, 0, sizeof(LcCfg));
+}
 
-   DU_LOG("\n F1AP : Building UE Context Setup Response\n");
+/*******************************************************************
+ *
+ * @brief Function to free DuUeCfg
+ *
+ * @details
+ *
+ *    Function : freeDuUeCfg
+ *
+ *    Functionality: Function to free DuUeCfg
+ *
+ * @params[in] DuUeCfg *ueCfg
+ * @return void
+ *
+ * ****************************************************************/
+void freeDuUeCfg(DuUeCfg *ueCfg)
+{
+   uint8_t lcIdx;
 
-   while(true)
+   for(lcIdx = 0; lcIdx < ueCfg->numRlcLcs; lcIdx++)
    {
-      DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
-      if(f1apMsg == NULLP)
-      {
-        DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
-        break;
-      }
+      freeRlcLcCfg(&ueCfg->rlcLcCfg[lcIdx]);
+   }
+   for(lcIdx = 0; lcIdx < ueCfg->numMacLcs; lcIdx++)
+   {
+      freeMacLcCfg(&ueCfg->macLcCfg[lcIdx]);
+   }
+   if(ueCfg->maxAggrBitRate)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCfg->maxAggrBitRate, sizeof(MaxAggrBitRate));
+   }
+}
 
-      f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
-      DU_ALLOC(f1apMsg->choice.successfulOutcome,
-           sizeof(SuccessfulOutcome_t));
-      if(f1apMsg->choice.successfulOutcome == NULLP)
-      {
-        DU_LOG(" F1AP : Memory allocation for  F1AP-PDU failed");
-        break;
-      }
+/*******************************************************************
+ *
+ * @brief Function to free UecontextSetupDb
+ *
+ * @details
+ *
+ *    Function : freeF1UeDb
+ *
+ *    Functionality: Function to free UecontextSetupDb
+ *
+ * @params[in] UecontextSetupDb *
+ * @return void
+ *
+ * ****************************************************************/
 
-      f1apMsg->choice.successfulOutcome->procedureCode = \
-                                                        ProcedureCode_id_UEContextSetup;
-      f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
-      f1apMsg->choice.successfulOutcome->value.present = \
-                                                        SuccessfulOutcome__value_PR_UEContextSetupResponse;
+void freeF1UeDb(UeContextSetupDb *f1UeDb)
+{
+   if(f1UeDb->cellGrpCfg)
+   {
+      DU_FREE(f1UeDb->cellGrpCfg, sizeof(CellGroupConfigRrc_t));
+      f1UeDb->cellGrpCfg = NULLP;
+   }
+   if(f1UeDb->rrcMsg)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, f1UeDb->rrcMsg, f1UeDb->rrcMsgLen);
+   }
+   
+   freeDuUeCfg(&f1UeDb->duUeCfg);
+   memset(f1UeDb, 0, sizeof(UeContextSetupDb));
 
-      ueSetRsp =
-        &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse;
-      elementCnt = 2;
-      ueSetRsp->protocolIEs.list.count = elementCnt;
-      ueSetRsp->protocolIEs.list.size = \
-                                       elementCnt * sizeof(UEContextSetupResponse_t *);
+}
 
-      /* Initialize the UESetup members */
-      DU_ALLOC(ueSetRsp->protocolIEs.list.array, \
-           ueSetRsp->protocolIEs.list.size);
-      if(ueSetRsp->protocolIEs.list.array == NULLP)
+/*******************************************************************
+ *
+ * @brief Function to build Am cfg Info
+ *
+ * @details
+ *
+ *    Function : extractRlcAmCfg
+ *
+ *    Functionality: Function to build Am cfg Info
+ *
+ * @params[in] AmBearerCfg *
+ *             void *
+ *
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+
+void extractRlcAmCfg(AmBearerCfg *amCfgToSet, struct RLC_Config__am *rlcAmCfg)
+{
+   if(rlcAmCfg)
+   {
+      /* UL AM */
+      if(rlcAmCfg->dl_AM_RLC.sn_FieldLength)
       {
-        DU_LOG(" F1AP : Memory allocation for UE Setup Response failed");
-        break;
+        amCfgToSet->ulAmCfg.snLenUl = *(rlcAmCfg->dl_AM_RLC.sn_FieldLength);
+        amCfgToSet->ulAmCfg.reAssemTmr = rlcAmCfg->dl_AM_RLC.t_Reassembly;
+        amCfgToSet->ulAmCfg.statProhTmr = rlcAmCfg->dl_AM_RLC.t_StatusProhibit;
       }
 
-      for(idx=0; idx<elementCnt; idx++)
+      /* DL AM */
+      if(rlcAmCfg->ul_AM_RLC.sn_FieldLength)
       {
-        DU_ALLOC(ueSetRsp->protocolIEs.list.array[idx],\
-              sizeof(UEContextSetupResponseIEs_t));
-        if(ueSetRsp->protocolIEs.list.array[idx] == NULLP)
-        {
-           DU_LOG(" F1AP : Memory allocation for UE Setup Response failed");
-           break;
-        }
+        amCfgToSet->dlAmCfg.snLenDl = *(rlcAmCfg->ul_AM_RLC.sn_FieldLength);
+        amCfgToSet->dlAmCfg.pollRetxTmr = rlcAmCfg->ul_AM_RLC.t_PollRetransmit;
+        amCfgToSet->dlAmCfg.pollPdu   = rlcAmCfg->ul_AM_RLC.pollPDU;
+        amCfgToSet->dlAmCfg.pollByte  = rlcAmCfg->ul_AM_RLC.pollByte;
+        amCfgToSet->dlAmCfg.maxRetxTh = rlcAmCfg->ul_AM_RLC.maxRetxThreshold;
       }
+   }
+}
 
-      idx = 0;
-
-      /*GNB CU UE F1AP ID*/
-      ueSetRsp->protocolIEs.list.array[idx]->id        = \
-                                                 ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
-      ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
-      ueSetRsp->protocolIEs.list.array[idx]->value.present = \
-                                                            UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
-      ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = CU_ID;
+/*******************************************************************
+ *
+ * @brief Function to build Um Bi Info
+ *
+ * @details
+ *
+ *    Function : extractRlcUmBiCfg
+ *
+ *    Functionality: Function to build Um Bi Info
+ *
+ * @params[in] UmBiDirBearerCfg *
+ *             void *
+ *
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
 
-      /*GNB DU UE F1AP ID*/
-      idx++;
-      ueSetRsp->protocolIEs.list.array[idx]->id        = \
-                                                 ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
-      ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
-      ueSetRsp->protocolIEs.list.array[idx]->value.present = \
-                                                            UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
-      ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = DU_ID;
+void extractRlcUmBiCfg(UmBiDirBearerCfg *umBiCfgToSet, struct RLC_Config__um_Bi_Directional *rlcBiCfg)
+{
+   if(rlcBiCfg)
+   {
+      /* UL UM BI DIR Cfg */
+      if(rlcBiCfg->dl_UM_RLC.sn_FieldLength)
+      {
+        umBiCfgToSet->ulUmCfg.snLenUlUm  = *(rlcBiCfg->dl_UM_RLC.sn_FieldLength);
+        umBiCfgToSet->ulUmCfg.reAssemTmr = rlcBiCfg->dl_UM_RLC.t_Reassembly;
+      }
 
+      /* DL UM BI DIR Cfg */
+      if(rlcBiCfg->ul_UM_RLC.sn_FieldLength)
+        umBiCfgToSet->dlUmCfg.snLenDlUm  = *(rlcBiCfg->ul_UM_RLC.sn_FieldLength);
+   }
+}
 
-      xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+/*******************************************************************
+ *
+ * @brief Function to build Um Ul Info
+ *
+ * @details
+ *
+ *    Function : extractRlcUmUlCfg
+ *
+ *    Functionality: Function to build Um Ul Info
+ *
+ * @params[in] UmUniDirUlBearerCfg *
+ *             void *
+ *
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
 
-      /* Encode the UE context setup response type as APER */
-      memset(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 UE Context Setup Request structure (at %s)\n",\
-              encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
-        break;
-      }
-      else
+void extractRlcUmUlCfg(UmUniDirUlBearerCfg *umUlCfgToSet, struct RLC_Config__um_Uni_Directional_DL *umUlCfg)
+{
+   if(umUlCfg)
+   {
+      if(umUlCfg->dl_UM_RLC.sn_FieldLength)
       {
-        DU_LOG("\n F1AP : Created APER encoded buffer for UE Context Setup Request\n");
-        for(int i=0; i< encBufSize; i++)
-        {
-           printf("%x",encBuf[i]);
-        }
+         umUlCfgToSet->ulUmCfg.snLenUlUm  = *(umUlCfg->dl_UM_RLC.sn_FieldLength);
+         umUlCfgToSet->ulUmCfg.reAssemTmr = umUlCfg->dl_UM_RLC.t_Reassembly;
       }
+   }
+}
 
-      /* Sending  msg  */
-      if(SendF1APMsg(DU_APP_MEM_REGION,DU_POOL)        !=      ROK)
-      {
-        DU_LOG("\n F1AP : Sending UE Context Setup Request Failed");
-        break;
-      }
-      ret = ROK;
-      break;
+/*******************************************************************
+ *
+ * @brief Function to build Um Uni Dl Info
+ *
+ * @details
+ *
+ *    Function : extractRlcUmDlCfg
+ *
+ *    Functionality: Function to build Um Uni Dl Info
+ *
+ * @params[in] UmUniDirDlBearerCfg *
+ *             void *
+ *
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+void extractRlcUmDlCfg(UmUniDirDlBearerCfg *umDlCfgToSet, struct RLC_Config__um_Uni_Directional_UL *umDlCfg)
+{
+   if(umDlCfg)
+   {
+      if(umDlCfg->ul_UM_RLC.sn_FieldLength)
+         umDlCfgToSet->dlUmCfg.snLenDlUm  = *(umDlCfg->ul_UM_RLC.sn_FieldLength);
    }
+}
 
-   FreeUeSetupRsp(f1apMsg);
-   return ret;;
-}/* End of BuildAndSendUESetRsp */
+/*******************************************************************
+ *
+ * @brief Function to extractRlcModeCfg
+ *
+ * @details
+ *
+ *    Function : extractRlcModeCfg
+ *
+ *    Functionality: Function to extractRlcModeCfg
+ *
+ * @params[in] RLC_Config_t *
+ *             RlcBearerCfg *
+ *             void  *    
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+void extractRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *rlcDbCfg, RLC_Config_t *lcCfg)
+{
+   if(lcCfg)
+   {
+      switch(rlcMode)
+      {
+         case RLC_AM :
+            {
+               if(lcCfg->choice.am)
+              {
+                  DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.amCfg, sizeof(AmBearerCfg));
+                 if(rlcDbCfg->u.amCfg)
+                    extractRlcAmCfg(rlcDbCfg->u.amCfg, lcCfg->choice.am);
+              }
+               break;
+            }
+         case RLC_UM_BI_DIRECTIONAL :
+            {
+               if(lcCfg->choice.um_Bi_Directional)
+              {
+                  DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
+                 if(rlcDbCfg->u.umBiDirCfg)
+                     extractRlcUmBiCfg(rlcDbCfg->u.umBiDirCfg, lcCfg->choice.um_Bi_Directional);
+              }
+               break;
+            }
+         case RLC_UM_UNI_DIRECTIONAL_UL :
+            {
+               if(lcCfg->choice.um_Uni_Directional_DL)
+               {
+                  DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
+                 if(rlcDbCfg->u.umUniDirUlCfg)
+                     extractRlcUmUlCfg(rlcDbCfg->u.umUniDirUlCfg, lcCfg->choice.um_Uni_Directional_DL);
+              }
+               break;
+            }
+         case RLC_UM_UNI_DIRECTIONAL_DL :
+            {
+               if(lcCfg->choice.um_Uni_Directional_UL)
+               {
+                  DU_ALLOC_SHRABL_BUF(rlcDbCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
+                 if(rlcDbCfg->u.umUniDirDlCfg)
+                     extractRlcUmDlCfg(rlcDbCfg->u.umUniDirDlCfg, lcCfg->choice.um_Uni_Directional_UL);
+              }
+               break;
+            }
+         default:
+            DU_LOG("\nDUAPP: Invalid rlcMode %d at extractRlcCfgToAddMod()", rlcMode);
+            break;
+      }
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to extract extractUlLcCfg
+ *
+ * @details
+ *
+ *    Function : extractUlLcCfg
+ *
+ *    Functionality: Function to extract extractUlLcCfg
+ *
+ * @params[in] UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractUlLcCfg(UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg)
+{
+   if(ulLcCfg)
+   {
+      if(ulLcCfg->ul_SpecificParameters)
+      {
+         f1UlLcCfg->priority = \
+            ulLcCfg->ul_SpecificParameters->priority;
+      if(ulLcCfg->ul_SpecificParameters->logicalChannelGroup)
+      {
+         f1UlLcCfg->lcGroup = \
+           *(ulLcCfg->ul_SpecificParameters->logicalChannelGroup);
+      }
+      if(ulLcCfg->ul_SpecificParameters->schedulingRequestID)
+      {
+         f1UlLcCfg->schReqId = \
+           *(ulLcCfg->ul_SpecificParameters->schedulingRequestID);
+      }
+      f1UlLcCfg->pbr = \
+         ulLcCfg->ul_SpecificParameters->prioritisedBitRate;
+      f1UlLcCfg->bsd = \
+         ulLcCfg->ul_SpecificParameters->bucketSizeDuration;
+      }
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Function to procRlcLcCfg
+ *
+ * @details
+ *
+ *    Function : procRlcLcCfg
+ *
+ *    Functionality: Function to procRlcLcCfg
+ *
+ * @params[in] rbId, lcId, rbType, rlcMod
+ *             RLC_Config_t *, RlcBearerCfg * , 
+ * @return void
+ *
+ * ****************************************************************/
+
+void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\
+   uint8_t configType, RLC_Config_t *f1RlcCfg, RlcBearerCfg *lcCfg)
+{
+
+   lcCfg->rbId   = rbId;
+   lcCfg->configType = configType;
+
+   if(rbType == RB_TYPE_SRB)
+   {
+      lcCfg->rbType = RB_TYPE_SRB;
+      lcCfg->lcId   = rbId;
+      lcCfg->lcType = LCH_DCCH;
+      lcCfg->rlcMode = RLC_AM;
+   }
+   else if(rbType == RB_TYPE_DRB)
+   {
+      lcCfg->rbType = RB_TYPE_DRB;
+      lcCfg->lcId   = lcId;
+      lcCfg->lcType = LCH_DTCH;
+      lcCfg->rlcMode = rlcMode;
+   }
+   if(f1RlcCfg) /* rlc mode config recived */
+   {
+      extractRlcModeCfg(lcCfg->rlcMode, lcCfg, f1RlcCfg);
+   }
+}
+
+
+
+/*******************************************************************
+ *
+ * @brief Fills DrbQos Info received by CU
+ *
+ * @details
+ *
+ *    Function : extractQosInfo
+ *
+ *    Functionality: Fills DrbQos Info received  by CU
+ *
+ * @params[in] DrbQosInfo *qosToAdd, 
+ *             QoSFlowLevelQoSParameters_t *qosFlowCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractQosInfo(DrbQosInfo *qosToAdd, QoSFlowLevelQoSParameters_t *qosFlowCfg)
+{
+   qosToAdd->fiveQiType = qosFlowCfg->qoS_Characteristics.present;
+   qosToAdd->u.nonDyn5Qi.fiveQi     =\
+         qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI;
+   if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow)
+   {
+      qosToAdd->u.nonDyn5Qi.avgWindow = \
+        *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
+   }
+   qosToAdd->u.nonDyn5Qi.maxDataBurstVol = \
+      *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
+   if(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel)
+   {
+      qosToAdd->u.nonDyn5Qi.priorLevel = \
+         *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel);
+   }
+   qosToAdd->ngRanRetPri.priorityLevel = \
+      qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel; 
+   qosToAdd->ngRanRetPri.preEmptionCap = \
+      qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability;
+   qosToAdd->ngRanRetPri.preEmptionVul = \
+      qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionVulnerability;
+   if(qosFlowCfg->gBR_QoS_Flow_Information)
+   {
+      memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateDl, \
+         qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.buf, \
+         qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateDownlink.size);
+      memcpy(&qosToAdd->grbQosInfo.maxFlowBitRateUl, \
+         qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.buf, \
+         qosFlowCfg->gBR_QoS_Flow_Information->maxFlowBitRateUplink.size);
+      memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateDl,\
+         qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.buf, \
+         qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink.size);
+      memcpy(&qosToAdd->grbQosInfo.guarFlowBitRateUl,\
+         qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.buf, \
+         qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.size);
+   }
+   qosToAdd->pduSessionId = 0;
+   qosToAdd->ulPduSessAggMaxBitRate = 0;
+}
+
+uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, LcCfg *macLcToAdd)
+{
+   DRB_Information_t *drbInfo = NULLP;
+
+   if(drbItem->qoSInformation.present == QoSInformation_PR_choice_extension)
+   {
+      if(drbItem->qoSInformation.choice.choice_extension->value.present ==
+           QoSInformation_ExtIEs__value_PR_DRB_Information)
+      {
+        drbInfo = &drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information;
+
+        if(!macLcToAdd->drbQos)
+        {
+           DU_ALLOC_SHRABL_BUF(macLcToAdd->drbQos, sizeof(DrbQosInfo));
+           if(macLcToAdd->drbQos == NULLP)
+           {
+              DU_LOG("\n DUAPP:Memory failed at allocating DrbQos at extractDrbCfg()");
+              return RFAILED;
+           }
+
+        }
+        if(drbInfo->dRB_QoS.qoS_Characteristics.present == QoS_Characteristics_PR_non_Dynamic_5QI)
+        {
+           extractQosInfo(macLcToAdd->drbQos, &drbInfo->dRB_QoS);
+            macLcToAdd->dlLcCfg.lcp = macLcToAdd->drbQos->ngRanRetPri.priorityLevel;
+        }
+        if(!macLcToAdd->snssai)
+        {
+           DU_ALLOC_SHRABL_BUF(macLcToAdd->snssai, sizeof(Snssai));
+           if(macLcToAdd->snssai == NULLP)
+           {
+              DU_LOG("\n DUAPP:Memory failed at allocating SNSSAI at extractDrbCfg()");
+              return RFAILED;
+           }
+        }
+        memcpy(&macLcToAdd->snssai->sst, drbInfo->sNSSAI.sST.buf, \
+              drbInfo->sNSSAI.sST.size);
+        if(drbInfo->sNSSAI.sD)
+        {
+           memcpy(macLcToAdd->snssai->sd, drbInfo->sNSSAI.sD->buf, \
+                 drbInfo->sNSSAI.sD->size);
+        }
+      }/*End of DRB Info*/
+   }
+   return ROK;
+}
+
+uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg)
+{
+   uint8_t ret = ROK;
+
+   if(drbCfg)
+   {
+      ret = extractDrbCfg(drbCfg, lcCfg);
+      if(ret == RFAILED)
+      {
+         DU_LOG("F1AP: Failed to build Drb Qos at extractMacRbCfg()");
+        return ret;
+      }
+   }
+   else
+   {
+      lcCfg->drbQos = NULLP;
+      lcCfg->snssai = NULLP;
+      if(lcCfg->lcId == SRB2_LCID)
+         lcCfg->dlLcCfg.lcp = LC_PRIORITY_3;
+      else
+         lcCfg->dlLcCfg.lcp = LC_PRIORITY_1;
+   }
+   if(ulLcCfg)
+   {
+      lcCfg->ulLcCfgPres = true;
+      extractUlLcCfg(&lcCfg->ulLcCfg, ulLcCfg);
+   }
+   else
+      lcCfg->ulLcCfgPres = false;
+   return ret;
+}
+
+uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType,\
+   DRBs_ToBeSetup_Item_t *drbItem, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg)
+{
+   uint8_t ret = ROK;
+
+   lcCfg->lcId = lcId;
+   lcCfg->configType = configType;
+   if(rbType == RB_TYPE_SRB)
+   {
+      ret = extractMacRbCfg(lcId, NULL, ulLcCfg, lcCfg);
+   }
+   else if(rbType == RB_TYPE_DRB)
+   {
+      ret = extractMacRbCfg(lcId, drbItem, ulLcCfg, lcCfg);
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Function to extract Rlc cfg To Add/Mod in CellGrp Info
+ *
+ * @details
+ *
+ *    Function : extractRlcCfgToAddMod
+ *
+ *    Functionality: Function to extract Rlc cfg To Add/Mod in CellGrp Info
+ *
+ * @params[in] CellGroupConfigRrc__rlc_BearerTo pointer
+ *             DuUeCfg Pointer
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+
+uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList *lcCfg, \
+   DuUeCfg *ueCfgDb)
+{
+  uint8_t ret, idx, rbId, lcId, rlcMode, rbType;
+  RLC_Config_t *f1RlcCfg = NULLP;
+  LogicalChannelConfig_t *macUlLcCfg = NULLP;
+
+  for(idx = 0; idx < lcCfg->list.count; idx++)
+  {
+     lcId = lcCfg->list.array[idx]->logicalChannelIdentity;
+     if(lcCfg->list.array[idx]->servedRadioBearer)
+     {
+        /* RadioBearer for SRB/DRB */
+        if(lcCfg->list.array[idx]->servedRadioBearer->present ==\
+        RLC_BearerConfig__servedRadioBearer_PR_srb_Identity)
+        {
+           rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.srb_Identity;
+           rbType = RB_TYPE_SRB;
+        }
+        else if(lcCfg->list.array[idx]->servedRadioBearer->present ==\
+        RLC_BearerConfig__servedRadioBearer_PR_drb_Identity)
+        {
+           rbId = lcCfg->list.array[idx]->servedRadioBearer->choice.drb_Identity;
+           rbType = RB_TYPE_DRB;
+        }
+        else
+        {
+           DU_LOG("\n No components present in Bearer config to ADD/MOD");
+           return RFAILED;
+        }
+        /* MAC UL LC Config */
+        if(lcCfg->list.array[idx]->mac_LogicalChannelConfig)
+        {
+           macUlLcCfg = lcCfg->list.array[idx]->mac_LogicalChannelConfig;
+        }
+     }
+     else
+     {
+        DU_LOG("\nDUAPP: Received RadioBearer config is NULL");
+        return RFAILED;
+     }
+     /* RLC Mode Config */
+     if(lcCfg->list.array[idx]->rlc_Config)
+     {
+        rlcMode  = lcCfg->list.array[idx]->rlc_Config->present;
+        f1RlcCfg = lcCfg->list.array[idx]->rlc_Config;
+     }
+     
+     /* Filling RLC/MAC Config*/
+     memset(&ueCfgDb->macLcCfg[idx], 0, sizeof(LcCfg));
+     memset(&ueCfgDb->rlcLcCfg[idx], 0, sizeof(RlcBearerCfg));
+     procRlcLcCfg(rbId, lcId, rbType, rlcMode, CONFIG_UNKNOWN, f1RlcCfg, &(ueCfgDb->rlcLcCfg[idx]));
+     ret = procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx]);
+     if(ret == RFAILED)
+     {
+        DU_LOG("\nDUAPP: Failed while filling MAC LC config at extractRlcCfgToAddMod()");
+        return ret;
+     }
+     (ueCfgDb->numRlcLcs)++;
+     (ueCfgDb->numMacLcs)++;
+  }
+  //TODO: To send the failure cause in UeContextSetupRsp 
+  return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief DeAlloc pdsch serv cell config info
+ *
+ * @details
+ *
+ *    Function : freeMacPdschServCellInfo
+ *
+ *    Functionality: DeAlloc pdsch serv cell config info
+ *
+ * @params[in] PdschServCellCfg pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+void freeMacPdschServCellInfo(PdschServCellCfg *pdsch)
+{
+   if(pdsch->xOverhead)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->xOverhead, sizeof(uint8_t));
+   }
+   if(pdsch->codeBlkGrpFlushInd)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->codeBlkGrpFlushInd, sizeof(bool));
+   }
+   if(pdsch->maxCodeBlkGrpPerTb)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxCodeBlkGrpPerTb, sizeof(uint8_t));
+   }
+   if(pdsch->maxMimoLayers)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxMimoLayers, sizeof(uint8_t));
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Free Serving cell Info
+ *
+ * @details
+ *
+ *    Function : freeMacServingCellInfo
+ *
+ *    Functionality: Free Serving cell Info
+ *
+ * @params[in] ServCellCfgInfo *srvCellCfg
+ * @return void
+ *
+ * ****************************************************************/
+void freeMacServingCellInfo(ServCellCfgInfo *srvCellCfg)
+{
+   freeMacPdschServCellInfo(&srvCellCfg->pdschServCellCfg);
+   if(srvCellCfg->bwpInactivityTmr)
+   {
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, srvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Free cell Grp Cfg Info
+ *
+ * @details
+ *
+ *    Function : freeUeReCfgCellGrpInfo
+ *
+ *    Functionality: Free cell Grp Cfg Info
+ *
+ * @params[in] MacUeCfg*  duUeCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+void freeUeReCfgCellGrpInfo(MacUeCfg *macUeCfg)
+{
+   freeMacServingCellInfo(&macUeCfg->spCellCfg.servCellCfg);
+}
+
+/*******************************************************************
+ *
+ * @brief Fills Reconfig SchReqReConfig
+ *
+ * @details
+ *
+ *    Function : extractSchReqReConfig
+ *
+ *    Functionality: Fills Reconfig SchReqReConfig
+ *
+ * @params[in] SchedulingRequestConfig_t *cuSchedReq
+ *             SchedReqCfg*  macSchedReq
+ * @return void
+ *
+ * ****************************************************************/
+void extractSchReqReConfig(SchedulingRequestConfig_t *cuSchedReq, SchedReqCfg *macSchedReq)
+{
+   uint8_t schReqIdx = 0;
+   struct SchedulingRequestConfig__schedulingRequestToAddModList *schReqListToAdd = NULLP;
+   struct SchedulingRequestConfig__schedulingRequestToReleaseList *schReqListToRel = NULLP;
+
+   if(cuSchedReq->schedulingRequestToAddModList)
+   {
+      schReqListToAdd = cuSchedReq->schedulingRequestToAddModList;
+      if(schReqListToAdd->list.count)
+      {
+        macSchedReq->addModListCount = schReqListToAdd->list.count;
+        for(schReqIdx = 0; schReqIdx < schReqListToAdd->list.count; schReqIdx++)
+        {
+           macSchedReq->addModList[schReqIdx].schedReqId = \
+              schReqListToAdd->list.array[schReqIdx]->schedulingRequestId;
+           macSchedReq->addModList[schReqIdx].srProhibitTmr = \
+              *(schReqListToAdd->list.array[schReqIdx]->sr_ProhibitTimer);
+           macSchedReq->addModList[schReqIdx].srTransMax    =\
+              schReqListToAdd->list.array[schReqIdx]->sr_TransMax;
+        }
+      }
+   }
+   /* Scheduling Req To release */
+   if(cuSchedReq->schedulingRequestToReleaseList)
+   {
+      schReqListToRel = cuSchedReq->schedulingRequestToReleaseList;
+      if(schReqListToRel->list.count)
+      {
+        macSchedReq->relListCount = schReqListToRel->list.count;
+        for(schReqIdx = 0; schReqIdx < schReqListToRel->list.count; schReqIdx++)
+        {
+           macSchedReq->relList[schReqIdx] = \
+              *schReqListToRel->list.array[schReqIdx];
+        }
+      }
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Fills TagReconfig
+ *
+ * @details
+ *
+ *    Function : extractTagReconfig
+ *
+ *    Functionality: Fills extractTagReconfig
+ *
+ * @params[in] TAG_Config_t *cuTagCfg
+ *             TagCfg *macTagCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractTagReconfig(TAG_Config_t *cuTagCfg, TagCfg *macTagCfg)
+{
+  uint8_t tagIdx = 0;
+  struct TAG_Config__tag_ToAddModList  *tagListToAddMod = NULLP;
+  struct TAG_Config__tag_ToReleaseList *tagListToRel = NULLP;
+
+  /* Tag config to AddMod */
+  if(cuTagCfg->tag_ToAddModList)
+  {
+     tagListToAddMod = cuTagCfg->tag_ToAddModList; 
+     if(tagListToAddMod->list.count)
+     {
+        macTagCfg->addModListCount = tagListToAddMod->list.count;
+        for(tagIdx = 0; tagIdx < tagListToAddMod->list.count; tagIdx++)
+       {
+           macTagCfg->addModList[tagIdx].tagId =\
+              tagListToAddMod->list.array[tagIdx]->tag_Id;     
+           macTagCfg->addModList[tagIdx].timeAlignTimer = \
+
+              tagListToAddMod->list.array[tagIdx]->timeAlignmentTimer;
+       }
+     }
+  }
+  /* Tag config to release */
+  if(cuTagCfg->tag_ToReleaseList)
+  {
+     tagListToRel = cuTagCfg->tag_ToReleaseList;
+     if(tagListToRel->list.count)
+     {
+        macTagCfg->relListCount = tagListToRel->list.count;
+        for(tagIdx = 0; tagIdx < tagListToRel->list.count; tagIdx++)
+       {
+           macTagCfg->relList[tagIdx] = *tagListToRel->list.array[tagIdx];     
+       }
+     }
+  }
+}
+
+/*******************************************************************
+ *
+ * @brief Fills PdcchCfg received by CU
+ *
+ * @details
+ *
+ *    Function : extractPdcchCfg
+ *
+ *    Functionality: Fills PdcchCfg received  by CU
+ *
+ * @params[in] PDCCH_Config_t *cuPdcchCfg,
+ *             PdcchConfig *duPdcchCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg)
+{
+   uint8_t cRsetIdx = 0;
+   uint8_t srchSpcIdx = 0;
+
+   struct PDCCH_Config__controlResourceSetToAddModList *cRsetToAddModList = NULLP;
+   struct PDCCH_Config__controlResourceSetToReleaseList *cRsetToRelList = NULLP;
+   struct PDCCH_Config__searchSpacesToAddModList *srchSpcToAddModList = NULLP;
+   struct PDCCH_Config__searchSpacesToReleaseList *srchSpcToRelList = NULLP;
+
+
+   /* Control Resource Set To Add/Mod List */
+   if(cuPdcchCfg->controlResourceSetToAddModList)
+   {
+      cRsetToAddModList = cuPdcchCfg->controlResourceSetToAddModList;
+      if(cRsetToAddModList->list.count)
+      {
+         macPdcchCfg->numCRsetToAddMod = cRsetToAddModList->list.count;
+        for(cRsetIdx = 0; cRsetIdx < cRsetToAddModList->list.count; cRsetIdx++)
+        {
+           macPdcchCfg->cRSetToAddModList[cRsetIdx].cRSetId = \
+             cRsetToAddModList->list.array[cRsetIdx]->controlResourceSetId;
+           bitStringToInt(&cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources,\
+              macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc);
+            macPdcchCfg->cRSetToAddModList[cRsetIdx].duration = \
+             cRsetToAddModList->list.array[cRsetIdx]->duration;
+
+           macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType = \
+             cRsetToAddModList->list.array[cRsetIdx]->cce_REG_MappingType.present;   
+            if(macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType == CCE_REG_MAPPINGTYPE_PR_INTERLEAVED)
+           {
+              //TODO: handle the case for Interleaved
+            }
+            macPdcchCfg->cRSetToAddModList[cRsetIdx].precoderGranularity = \
+             cRsetToAddModList->list.array[cRsetIdx]->precoderGranularity;
+           if(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID)
+           {
+              macPdcchCfg->cRSetToAddModList[cRsetIdx].dmrsScramblingId= \
+                 *(cRsetToAddModList->list.array[cRsetIdx]->pdcch_DMRS_ScramblingID);
+           }
+         }
+      }
+
+   }
+   /* Control Resource Set To Release List */
+   if(cuPdcchCfg->controlResourceSetToReleaseList)
+   {
+      cRsetToRelList = cuPdcchCfg->controlResourceSetToReleaseList;
+      if(cRsetToRelList->list.count)
+      {
+         macPdcchCfg->numCRsetToRel = cRsetToRelList->list.count;
+        for(cRsetIdx = 0; cRsetIdx < cRsetToRelList->list.count; cRsetIdx++)
+        {
+            macPdcchCfg->cRSetToRelList[cRsetIdx] = *(cRsetToRelList->list.array[cRsetIdx]);
+        }
+      }
+   }
+
+   /* Search space To Add/Mod List */
+   if(cuPdcchCfg->searchSpacesToAddModList)
+   {
+      srchSpcToAddModList = cuPdcchCfg->searchSpacesToAddModList;
+      if(srchSpcToAddModList->list.count)
+      {
+         macPdcchCfg->numSearchSpcToAddMod = srchSpcToAddModList->list.count;
+        for(srchSpcIdx = 0; srchSpcIdx < srchSpcToAddModList->list.count; srchSpcIdx++)
+        {
+            macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceId =\
+              srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceId;
+            macPdcchCfg->searchSpcToAddModList[srchSpcIdx].cRSetId =\
+              *(srchSpcToAddModList->list.array[srchSpcIdx]->controlResourceSetId);
+           if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset)
+           {
+               macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSlotPeriodicityAndOffset =\
+                 srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset->present;
+            }
+            if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot)
+            {
+              bitStringToInt(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot,\
+                 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSymbolsWithinSlot);
+            }
+           if(srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates)
+            {
+             macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel1 = \
+                 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel1;
+              macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel2 = \
+                 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel2;
+              macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel4 = \
+                 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel4;
+              
+              macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel8 = \
+                 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel8;
+              
+              macPdcchCfg->searchSpcToAddModList[srchSpcIdx].numCandidatesAggLevel16 = \
+                 srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates->aggregationLevel16;
+           }
+            if(srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType)
+           {
+              macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType =\
+                 srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->present;
+              if(macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceType == SEARCHSPACETYPE_PR_UE_SPECIFIC)
+              {
+                 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].ueSpecificDciFormat =\
+                    srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceType->choice.ue_Specific->dci_Formats;
+              }
+         
+           }
+        }
+      }
+   }
+   /* Search space To Rel List */
+   if(cuPdcchCfg->searchSpacesToReleaseList)
+   {
+      srchSpcToRelList = cuPdcchCfg->searchSpacesToReleaseList;
+      if(srchSpcToRelList->list.count)
+      {
+         macPdcchCfg->numSearchSpcToRel = srchSpcToRelList->list.count;
+        for(srchSpcIdx = 0; srchSpcIdx < srchSpcToRelList->list.count; srchSpcIdx++)
+        {
+            macPdcchCfg->searchSpcToRelList[srchSpcIdx] =\
+              *(srchSpcToRelList->list.array[srchSpcIdx]);
+        }
+      }
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Fills PdschCfg received by CU
+ *
+ * @details
+ *
+ *    Function : extractPdschCfg
+ *
+ *    Functionality: Fills PdschCfg received  by CU
+ *
+ * @params[in] PDSCH_Config_t *cuPdschCfg,
+ *             PdschConfig *macPdschCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractPdschCfg(PDSCH_Config_t *cuPdschCfg, PdschConfig *macPdschCfg)
+{
+   uint8_t timeDomIdx;
+   struct PDSCH_Config__pdsch_TimeDomainAllocationList *timeDomAlloc = NULLP;
+
+   if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA)
+   {
+      if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->present == \
+         PDSCH_Config__dmrs_DownlinkForPDSCH_MappingTypeA_PR_setup)
+      {
+         if(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)
+        {
+            macPdschCfg->dmrsDlCfgForPdschMapTypeA.addPos = \
+              *(cuPdschCfg->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition);
+        }
+      }
+   }
+   macPdschCfg->resourceAllocType = cuPdschCfg->resourceAllocation;
+   if(cuPdschCfg->pdsch_TimeDomainAllocationList)
+   {
+      timeDomAlloc = cuPdschCfg->pdsch_TimeDomainAllocationList;
+      if(timeDomAlloc->present ==\
+         PDSCH_Config__pdsch_TimeDomainAllocationList_PR_setup)
+      {
+         if(timeDomAlloc->choice.setup)
+        {
+           macPdschCfg->numTimeDomRsrcAlloc  = timeDomAlloc->choice.setup->list.count;
+            for(timeDomIdx = 0; timeDomIdx < timeDomAlloc->choice.setup->list.count; timeDomIdx++)
+            {
+              macPdschCfg->timeDomRsrcAllociList[timeDomIdx].mappingType = \
+                 timeDomAlloc->choice.setup->list.array[timeDomIdx]->mappingType;
+              //macPdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbol = \
+                 
+              //macPdschCfg->timeDomRsrcAllociList[timeDomIdx].symbolLength;
+              macPdschCfg->timeDomRsrcAllociList[timeDomIdx].startSymbolAndLength = \
+                 timeDomAlloc->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
+           }
+        }
+      }
+   }
+   macPdschCfg->rbgSize = cuPdschCfg->rbg_Size; 
+   if(cuPdschCfg->maxNrofCodeWordsScheduledByDCI)
+      macPdschCfg->numCodeWordsSchByDci = *(cuPdschCfg->maxNrofCodeWordsScheduledByDCI);
+   if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_staticBundling)
+   {
+      macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present;
+      if(cuPdschCfg->prb_BundlingType.choice.staticBundling)
+      {
+         if(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize)
+        {
+            macPdschCfg->bundlingInfo.StaticBundling.size = \
+              *(cuPdschCfg->prb_BundlingType.choice.staticBundling->bundleSize);
+        }
+      }
+   }
+   else if(cuPdschCfg->prb_BundlingType.present == PDSCH_Config__prb_BundlingType_PR_dynamicBundling)
+   {
+      macPdschCfg->bundlingType = cuPdschCfg->prb_BundlingType.present;
+   }
+
+}
+
+/*******************************************************************
+ *
+ * @brief Fills PdschServingCellCfg received by CU
+ *
+ * @details
+ *
+ *    Function : extractPdschServingCellCfg
+ *
+ *    Functionality: Fills PdschCfg received  by CU
+ *
+ * @params[in] PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg,
+ *             PdschServCellCfg *macUePdschSrvCellCfg
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+
+uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg, PdschServCellCfg *macUePdschSrvCellCfg)
+{
+   if(cuPdschSrvCellCfg->codeBlockGroupTransmission)
+   {
+      if(cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup)
+      {
+         if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
+         {
+            *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)  = \
+              cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
+        }
+        else
+        {
+            DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(uint8_t));
+            if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
+           {
+               *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)  = \
+                 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->maxCodeBlockGroupsPerTransportBlock;
+           }
+           else
+           {
+              DU_LOG("\nDUAPP: Memory allocation failed for maxCodeBlkGrpPerTb at extractPdschServingCellCfg()");
+              return RFAILED;
+           }
+        }
+         if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
+         {
+            *(macUePdschSrvCellCfg->codeBlkGrpFlushInd)  = \
+              cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator;
+        }
+        else
+        {
+            DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(bool));
+            if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
+           {
+               *(macUePdschSrvCellCfg->codeBlkGrpFlushInd)  = \
+                 cuPdschSrvCellCfg->codeBlockGroupTransmission->choice.setup->codeBlockGroupFlushIndicator;
+           }
+           else
+           {
+              DU_LOG("\nDUAPP: Memory allocation failed for codeBlkGrpFlushInd at extractPdschServingCellCfg()");
+              return RFAILED;
+           }
+        }
+      }
+   }
+   if(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH)
+   {
+      macUePdschSrvCellCfg->numHarqProcForPdsch = *(cuPdschSrvCellCfg->nrofHARQ_ProcessesForPDSCH); 
+   }
+   if(cuPdschSrvCellCfg->ext1)
+   {
+      if(cuPdschSrvCellCfg->ext1->maxMIMO_Layers)
+      {
+        if(macUePdschSrvCellCfg->maxMimoLayers)
+       {
+           *(macUePdschSrvCellCfg->maxMimoLayers)  = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers);
+       }
+       else
+       {
+           DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxMimoLayers, sizeof(uint8_t));
+           if(macUePdschSrvCellCfg->maxMimoLayers)
+          {
+              *(macUePdschSrvCellCfg->maxMimoLayers)  = *(cuPdschSrvCellCfg->ext1->maxMIMO_Layers);
+          }
+          else
+          {
+             DU_LOG("\nDUAPP: Memory allocation failed for maxMimoLayers at extractPdschServingCellCfg()");
+             return RFAILED;
+          }
+       }
+      }
+   }
+   if(cuPdschSrvCellCfg->xOverhead)
+   {
+      if(macUePdschSrvCellCfg->xOverhead)
+      {
+         *(macUePdschSrvCellCfg->xOverhead)  = *(cuPdschSrvCellCfg->xOverhead);
+      }
+      else
+      {
+         DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->xOverhead, sizeof(uint8_t));
+         if(macUePdschSrvCellCfg->xOverhead)
+         {
+            *(macUePdschSrvCellCfg->xOverhead)  = *(cuPdschSrvCellCfg->xOverhead);
+         }
+         else
+         {
+            DU_LOG("\nDUAPP: Memory allocation failed for xOverhead at extractPdschServingCellCfg()");
+           return RFAILED;
+         }
+      }
+   }
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills PuschCfg received by CU
+ *
+ * @details
+ *
+ *    Function : extractPuschCfg
+ *
+ *    Functionality: Fills PuschCfg received  by CU
+ *
+ * @params[in] BWP_UplinkDedicated__pusch_Config *cuPuschCfg,
+ *             PuschCfg *macPuschCfg
+ * @return void
+ *
+ * ****************************************************************/
+
+void extractPuschCfg(struct BWP_UplinkDedicated__pusch_Config *cuPuschCfg, PuschCfg *macPuschCfg)
+{
+   uint8_t timeDomIdx = 0;
+   DMRS_UplinkConfig_t *dmrsUlCfg = NULLP;
+   struct PUSCH_Config__pusch_TimeDomainAllocationList *timeDomAllocList = NULLP;
+
+   if(cuPuschCfg->present == BWP_UplinkDedicated__pusch_Config_PR_setup)
+   {
+      if(cuPuschCfg->choice.setup)
+      {
+         if(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH)
+        {
+             macPuschCfg->dataScramblingId = \
+               *(cuPuschCfg->choice.setup->dataScramblingIdentityPUSCH);
+        }
+        if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA)
+        {
+           if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->present == PUSCH_Config__dmrs_UplinkForPUSCH_MappingTypeA_PR_setup)
+           {
+              if(cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup)
+              {
+                 dmrsUlCfg = (cuPuschCfg->choice.setup->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup);
+                 if(dmrsUlCfg->dmrs_AdditionalPosition)
+                 {
+                     macPuschCfg->dmrsUlCfgForPuschMapTypeA.addPos =\
+                       *(dmrsUlCfg->dmrs_AdditionalPosition);
+                 }
+                  if(dmrsUlCfg->transformPrecodingDisabled)
+                 {
+                    if(dmrsUlCfg->transformPrecodingDisabled->scramblingID0)
+                    {
+                       macPuschCfg->dmrsUlCfgForPuschMapTypeA.transPrecodDisabled.scramblingId0 = \
+                          *(dmrsUlCfg->transformPrecodingDisabled->scramblingID0);
+                     }
+                 }
+              }
+           }
+        }
+        /*Res Alloc Type for UL */
+        if(cuPuschCfg->choice.setup->resourceAllocation)
+        {
+            macPuschCfg->resourceAllocType = \
+              cuPuschCfg->choice.setup->resourceAllocation;
+        }
+        if(cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList)
+        {
+           timeDomAllocList = cuPuschCfg->choice.setup->pusch_TimeDomainAllocationList;
+           if(timeDomAllocList->present == PUSCH_Config__pusch_TimeDomainAllocationList_PR_setup)
+           {
+               if(timeDomAllocList->choice.setup)
+              {
+                 macPuschCfg->numTimeDomRsrcAlloc = timeDomAllocList->choice.setup->list.count;
+                 for(timeDomIdx = 0; timeDomIdx <timeDomAllocList->choice.setup->list.count; timeDomIdx++)
+                 {
+                    macPuschCfg->timeDomRsrcAllocList[timeDomIdx].k2 = \
+                       *(timeDomAllocList->choice.setup->list.array[timeDomIdx]->k2);
+                     macPuschCfg->timeDomRsrcAllocList[timeDomIdx].mappingType = \
+                                       timeDomAllocList->choice.setup->list.array[timeDomIdx]->mappingType;
+                     macPuschCfg->timeDomRsrcAllocList[timeDomIdx].startSymbolAndLength = \
+                       timeDomAllocList->choice.setup->list.array[timeDomIdx]->startSymbolAndLength;
+                    //macPuschCfg->timeDomRsrcAllocList[timeDomIdx].startSymbol = \
+                       timeDomAllocList->choice.setup->list.array[timeDomIdx]->startSymbol;
+                    //macPuschCfg->timeDomRsrcAllocList[timeDomIdx].symbolLen = \
+                       timeDomAllocList->choice.setup->list.array[timeDomIdx]->symbolLen;
+                  }
+              }
+           }
+        }
+        if(cuPuschCfg->choice.setup->transformPrecoder)
+            macPuschCfg->transformPrecoder = *(cuPuschCfg->choice.setup->transformPrecoder);
+      }
+   }
+}
+/*******************************************************************
+ *
+ * @brief Fills ServingCellReconfig received by CU
+ *
+ * @details
+ *
+ *    Function : extractServingCellReconfig
+ *
+ *    Functionality: Fills ServingCellReconfig received  by CU
+ *
+ * @params[in] ServingCellConfig_t *cuSrvCellCfg
+ *             ServCellCfgInfo *macSrvCellCfg
+ * @return ROK/RFAILD
+ *
+ * ****************************************************************/
+uint8_t extractServingCellReconfig(ServingCellConfig_t *cuSrvCellCfg, ServCellCfgInfo *macSrvCellCfg)
+{
+   uint8_t ret = ROK;
+   BWP_DownlinkDedicated_t *dlBwp = NULLP;
+   BWP_UplinkDedicated_t   *ulBwp = NULLP;
+
+   if(cuSrvCellCfg->initialDownlinkBWP)
+   {
+      dlBwp = ((BWP_DownlinkDedicated_t *)(cuSrvCellCfg->initialDownlinkBWP));
+      if(dlBwp->pdcch_Config)
+      {
+         if(dlBwp->pdcch_Config->choice.setup)
+        {
+           extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
+        }
+      }
+      if(dlBwp->pdsch_Config)
+      {
+         if(dlBwp->pdsch_Config->choice.setup)
+        {
+           extractPdschCfg(dlBwp->pdsch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdschCfg);
+        }
+      }
+   }
+   if(cuSrvCellCfg->firstActiveDownlinkBWP_Id)
+      macSrvCellCfg->firstActvDlBwpId = *(cuSrvCellCfg->firstActiveDownlinkBWP_Id);
+   if(cuSrvCellCfg->defaultDownlinkBWP_Id)
+      macSrvCellCfg->defaultDlBwpId = *(cuSrvCellCfg->defaultDownlinkBWP_Id);
+   if(cuSrvCellCfg->bwp_InactivityTimer)
+   {
+      if(macSrvCellCfg->bwpInactivityTmr)
+      {
+         memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t));
+      }
+      else
+      {
+         macSrvCellCfg->bwpInactivityTmr = NULLP;
+         DU_ALLOC_SHRABL_BUF(macSrvCellCfg->bwpInactivityTmr, sizeof(uint8_t));
+        if(macSrvCellCfg->bwpInactivityTmr)
+        {
+            memcpy(macSrvCellCfg->bwpInactivityTmr, cuSrvCellCfg->bwp_InactivityTimer, sizeof(uint8_t));
+        }
+        else
+        {
+           DU_LOG("\nMemory Alloc failed for bwpInactivityTmr at extractServingCellReconfig()");
+           return RFAILED;
+        }
+      }
+   }
+   if(cuSrvCellCfg->pdsch_ServingCellConfig)
+   {
+      if(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup)
+      {
+         ret = extractPdschServingCellCfg(cuSrvCellCfg->pdsch_ServingCellConfig->choice.setup, &macSrvCellCfg->pdschServCellCfg);
+         if(ret == RFAILED)
+        {
+           DU_LOG("\nFailed at extractPdschServingCellCfg()");
+           return RFAILED;
+        }
+      }
+   }
+   if(cuSrvCellCfg->uplinkConfig)
+   {
+     if(cuSrvCellCfg->uplinkConfig->initialUplinkBWP)
+     {
+        ulBwp = ((BWP_UplinkDedicated_t *)(cuSrvCellCfg->uplinkConfig->initialUplinkBWP));
+       if(ulBwp->pusch_Config)
+       {
+          macSrvCellCfg->initUlBwp.puschPresent = true;
+           extractPuschCfg(ulBwp->pusch_Config, &macSrvCellCfg->initUlBwp.puschCfg);
+       }
+       if(ulBwp->pucch_Config)
+       {
+          macSrvCellCfg->initUlBwp.pucchPresent = true;
+           //extractPucchCfg(ulBwp->pucch_Config, &macSrvCellCfg->initUlBwp.pucchCfg); 
+       }
+     }
+     if(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id)
+        macSrvCellCfg->firstActvUlBwpId = *(cuSrvCellCfg->uplinkConfig->firstActiveUplinkBWP_Id);
+
+   }
+   return ret;
+}
+/*******************************************************************
+ *
+ * @brief Fills Reconfig Cell group Info received by CU
+ *
+ * @details
+ *
+ *    Function : extractUeReCfgCellInfo
+ *
+ *    Functionality: Fills Reconfig Cell group Info received by CU
+ *
+ * @params[in] CellGroupConfigRrc_t *macCellGrpCfg
+ *             MacUeCfg*  macUeCfg
+ * @return ROK/RFAILED
+ *
+ * ****************************************************************/
+uint8_t extractUeReCfgCellInfo(CellGroupConfigRrc_t *cellGrp, MacUeCfg *macUeCfg)
+{
+   uint8_t ret = ROK;
+   MAC_CellGroupConfig_t     *macCellGroup = NULLP;
+   PhysicalCellGroupConfig_t *phyCellGrpCfg = NULLP;
+   SpCellConfig_t            *spcellCfg = NULLP;
+   ServingCellConfig_t       *servCellCfg = NULLP;
+
+   if(cellGrp)
+   {
+      /* Fill MacCell Group Reconfig  */
+      if(cellGrp->mac_CellGroupConfig)
+      {
+         macCellGroup = ((MAC_CellGroupConfig_t *)(cellGrp->mac_CellGroupConfig));
+         if(macCellGroup->schedulingRequestConfig)
+        {
+            extractSchReqReConfig(macCellGroup->schedulingRequestConfig, &macUeCfg->macCellGrpCfg.schReqCfg);
+        }
+         if(macCellGroup->tag_Config)
+        {
+            extractTagReconfig(macCellGroup->tag_Config, &macUeCfg->macCellGrpCfg.tagCfg);
+        }
+      }
+      /* Fill Physical Cell Group Reconfig */
+      if(cellGrp->physicalCellGroupConfig)
+      {
+         phyCellGrpCfg = ((PhysicalCellGroupConfig_t *)(cellGrp->physicalCellGroupConfig));
+         if(phyCellGrpCfg->p_NR_FR1)
+        {
+           if(*(phyCellGrpCfg->p_NR_FR1) != macUeCfg->phyCellGrpCfg.pNrFr1)
+               macUeCfg->phyCellGrpCfg.pNrFr1 = *(phyCellGrpCfg->p_NR_FR1);
+        }
+         macUeCfg->phyCellGrpCfg.pdschHarqAckCodebook = phyCellGrpCfg->pdsch_HARQ_ACK_Codebook;
+      }
+      /* Fill SpCell Reconfig */
+      if(cellGrp->spCellConfig)
+      {
+         spcellCfg = ((SpCellConfig_t *)(cellGrp->spCellConfig));  
+         if(spcellCfg->servCellIndex)
+        {
+            macUeCfg->spCellCfg.servCellIdx = *(spcellCfg->servCellIndex);
+        }
+         /* Fill Serving cell Reconfig info */
+        if(cellGrp->spCellConfig->spCellConfigDedicated)
+        {
+           servCellCfg = ((ServingCellConfig_t *)(cellGrp->spCellConfig->spCellConfigDedicated));
+            ret = extractServingCellReconfig(servCellCfg, &macUeCfg->spCellCfg.servCellCfg);
+           if(ret == RFAILED)
+           {
+              DU_LOG("\n Failed at extractServingCellReconfig()");
+           }
+        }
+      }
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief builds Mac Cell Cfg
+ *
+ * @details
+ *
+ *    Function : procUeReCfgCellInfo
+ *
+ *    Functionality: builds Mac Cell Cfg
+ *
+ * @params[in] MacUeCfg pointer
+ *             void pointer
+ *
+ * @return void 
+ *
+ * ****************************************************************/
+uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfg, void *cellInfo)
+{
+   uint8_t ret = ROK;
+   CellGroupConfigRrc_t *cellGrp = NULLP;
+
+   if(cellInfo)
+   {
+      cellGrp = (CellGroupConfigRrc_t *)cellInfo;
+      ret = extractUeReCfgCellInfo(cellGrp, macUeCfg);
+      if(ret == RFAILED)
+         DU_LOG("\nF1AP: Failed at procUeReCfgCellInfo()");
+   }
+   if(ret == RFAILED)
+   {
+      freeUeReCfgCellGrpInfo(macUeCfg);
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Function to extract cellGrp Info present in cutoDu cont
+ *
+ * @details
+ *
+ *    Function : extractCellGrpInfo
+ *
+ *    Functionality: Function to extract cellGrp Info present
+ *                   in cutoDu cont
+ *
+ * @params[in] ProtocolExtensionContainer_4624P16_t pointer
+ *
+ * @return CellGroupConfigRrc_t *
+ *
+ * ****************************************************************/
+
+CellGroupConfigRrc_t *extractCellGrpInfo(ProtocolExtensionContainer_4624P16_t *protocolIeExtn,\
+   DuUeCfg *ueCfgDb)
+{
+   uint8_t idx2;
+   uint16_t id;
+   uint16_t recvBufLen;
+   CellGroupConfigRrc_t *cellGrpCfg = NULLP;
+   CUtoDURRCInformation_ExtIEs_t *extIeInfo = NULLP;
+   asn_dec_rval_t rval; /* Decoder return value */
+   memset(&rval, 0, sizeof(asn_dec_rval_t));
+
+   if(protocolIeExtn)
+   {
+      for(idx2 = 0; idx2 < protocolIeExtn->list.count; idx2++)
+      {
+         extIeInfo = ((CUtoDURRCInformation_ExtIEs_t *)(protocolIeExtn->list.array[idx2]));
+        id = extIeInfo->id;
+         switch(id)
+         {
+            case ProtocolIE_ID_id_CellGroupConfig:
+            {
+              recvBufLen = extIeInfo->extensionValue.choice.CellGroupConfig.size;
+              /* decoding the CellGroup Buf received */
+              DU_ALLOC(cellGrpCfg, sizeof(CellGroupConfigRrc_t));
+              if(cellGrpCfg)
+              {
+                  memset(cellGrpCfg, 0, sizeof(CellGroupConfigRrc_t));
+                  rval = aper_decode(0, &asn_DEF_CellGroupConfigRrc, (void **)&cellGrpCfg,
+                    extIeInfo->extensionValue.choice.CellGroupConfig.buf, recvBufLen, 0, 0);
+                  if(rval.code == RC_FAIL || rval.code == RC_WMORE)
+                  {
+                     DU_LOG("\nF1AP : ASN decode failed at decodeCellGrpCfg()");
+                     return NULLP;
+                  }
+                  xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, cellGrpCfg);
+                 if(extractRlcCfgToAddMod(cellGrpCfg->rlc_BearerToAddModList, ueCfgDb))
+                    return NULLP;
+              }
+              break;
+            }
+            default:
+               DU_LOG("\nF1AP : Invalid IE received CUtoDURRCInformation:%d at decodeCellGrpCfg()", id);
+              break;
+         }
+      }
+   }
+   return cellGrpCfg;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills Srb List received by CU
+ *
+ * @details
+ *
+ *    Function : procSrbListToSetup
+ *
+ *    Functionality: Fills Srb List received  by CU
+ *
+ * @params[in] SRBs_ToBeSetup_Item_t *cuSrbItem
+ *             LcCfg pointer
+ *             RlcBearerCfg pointer
+ * @return void
+ *
+ * ****************************************************************/
+uint8_t procSrbListToSetup(SRBs_ToBeSetup_Item_t * srbItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd)
+{
+   uint8_t ret = ROK;
+
+   /* Filling RLC INFO */
+   procRlcLcCfg(srbItem->sRBID, srbItem->sRBID, RB_TYPE_SRB, RLC_AM, CONFIG_ADD, NULL, rlcLcToAdd);
+
+   /* Filling MAC INFO */
+   ret = procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL, NULL, macLcToAdd);
+   if(ret == RFAILED)
+   { 
+      DU_LOG("\nF1AP:Failed at MAC LC Cfg in procSrbListToSetup()");
+      return ret;
+   }
+   return ret;
+}
+
+
+
+/*******************************************************************
+ *
+ * @brief extract Srb List received by CU
+ *
+ * @details
+ *
+ *    Function : extractSrbListToSetup
+ *
+ *    Functionality: extract Srb List received by CU
+ *                   for both MAC and RLC
+ *
+ * @params[in] SRBs_ToBeSetup_Item_t pointer
+ *             DuUeCfg pointer
+ * @return ROK/RFAIED
+ *
+ * ****************************************************************/
+
+uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb)
+{
+   uint8_t ret, srbIdx;
+   SRBs_ToBeSetup_Item_t *srbItem = NULLP;
+
+   if(srbCfg)
+   {
+      for(srbIdx = 0; srbIdx < srbCfg->list.count; srbIdx++)
+      {
+         srbItem = &srbCfg->list.array[srbIdx]->value.choice.SRBs_ToBeSetup_Item;
+         if(ueCfgDb->numMacLcs > MAX_NUM_LC)
+        { 
+            DU_LOG("\nF1AP:  MAX LC Reached in MAC");
+           ret = RFAILED;
+           break;
+        }
+         if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
+        {
+            DU_LOG("\nF1AP:  MAX LC Reached in RLC");
+           ret = RFAILED;
+           break;
+        }
+        memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
+        memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
+         ret = procSrbListToSetup(srbItem, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\
+           &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs]);
+        ueCfgDb->numRlcLcs++;
+        ueCfgDb->numMacLcs++;
+        if(ret == RFAILED)
+        {
+            DU_LOG("\nF1AP:  Failed at extractSrbListToSetup()");
+           break;
+        }
+      }
+   }
+   else
+      ret = RFAILED;
+
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Fills Drb List received by CU
+ *
+ * @details
+ *
+ *    Function : procDrbListToSetup
+ *
+ *    Functionality: Fills Drb List received by CU
+ *                   for both MAC and RLC
+ *
+ * @params[in] SRBs_ToBeSetup_Item_t pointer
+ *             LcCfg pointer,
+ *             RlcBearerCfg pointer
+ * @return void
+ *
+ * ****************************************************************/
+
+uint8_t procDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd)
+{
+   uint8_t ret = ROK;
+
+   /* Filling RLC INFO */
+   procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd);
+
+   /* Filling MAC INFO */
+   ret = procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, macLcToAdd);
+   if(ret == RFAILED)
+   { 
+      DU_LOG("\nF1AP:Failed at RLC LC Cfg in extractDrbListToSetup()");
+      return ret;
+   }
+
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief extract Drb List received by CU
+ *
+ * @details
+ *
+ *    Function : extractDrbListToSetup
+ *
+ *    Functionality: extract Drb List received by CU
+ *                   for both MAC and RLC
+ *
+ * @params[in] DRBs_ToBeSetup_Item_t pointer
+ *             DuUeCfg pointer
+ * @return ROK/RFAIED
+ *
+ * ****************************************************************/
+
+uint8_t extractDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_List_t *drbCfg, DuUeCfg *ueCfgDb)
+{
+   uint8_t ret, drbIdx;
+   DRBs_ToBeSetup_Item_t *drbItem = NULLP;
+
+   ret = ROK;
+   if(drbCfg)
+   {
+      for(drbIdx = 0; drbIdx < drbCfg->list.count; drbIdx++)
+      {
+         drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
+        if(ueCfgDb->numMacLcs > MAX_NUM_LC)
+        { 
+            DU_LOG("\nF1AP:  MAX LC Reached in MAC ");
+           ret = RFAILED;
+           break;
+        }
+        if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
+        {
+            DU_LOG("\nF1AP:  MAX LC Reached in RLC");
+           ret = RFAILED;
+           break;
+        }
+        memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
+        memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
+         ret = procDrbListToSetup(lcId, drbItem, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\
+           &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs]);
+        ueCfgDb->numRlcLcs++;
+        ueCfgDb->numMacLcs++;
+        if(ret == RFAILED)
+        {
+            DU_LOG("\nF1AP:  Failed at extractDrbListToSetup()");
+           break;
+        }
+      }
+   }
+   else
+      ret = RFAILED;
+
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Process UE context setup request from CU
+ *
+ * @details
+ *
+ *    Function : procF1UeContextSetupReq
+ *
+ *    Functionality: Process UE context setup request from CU
+ *
+ * @params[in] F1AP message
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
+{
+   uint8_t    ret, ieIdx, ueIdx, lcId, cellIdx;
+   bool ueCbFound = false;
+   uint32_t gnbCuUeF1apId, gnbDuUeF1apId;
+   DuUeCb   *duUeCb = NULLP;
+   UEContextSetupRequest_t   *ueSetReq = NULLP;
+    
+   ret = ROK;
+   
+   ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
+   for(ieIdx=0; (ieIdx < ueSetReq->protocolIEs.list.count && ret == ROK); ieIdx++)
+   {
+      switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
+      {
+        case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+           {
+              gnbCuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
+              break;
+           }
+        case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+           {
+              gnbDuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
+              break;
+           }
+        case ProtocolIE_ID_id_ServCellIndex:
+           {
+              cellIdx = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.ServCellIndex;
+               for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+              {
+                 if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
+                    (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
+                 {
+                    ueCbFound = true;
+                     duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
+                     DU_ALLOC(duUeCb->f1UeDb, sizeof(UeContextSetupDb));
+                     if(duUeCb->f1UeDb)
+                     {
+                        memset(duUeCb->f1UeDb, 0, sizeof(UeContextSetupDb));
+                       duUeCb->f1UeDb->actionType = UE_CTXT_SETUP;
+                       duUeCb->f1UeDb->cellIdx = cellIdx;
+                    }
+                    else
+                    {
+                        DU_LOG("\nF1AP: Memory Alloc Failed at procF1UeContextSetupReq()");
+                        ret = RFAILED;
+                    }
+                 }
+                 else
+                    ueCbFound = false;
+                 
+              }
+              if(!ueCbFound)
+              {
+                  DU_LOG("\nF1AP: DuUeCb is not found at procF1UeContextSetupReq()");
+                  ret = RFAILED;
+              }
+              break;
+           }
+         case ProtocolIE_ID_id_SpCellULConfigured:
+           /* Indicates whether the gNB-CU requests the gNB-DU to configure the uplink as no UL, 
+           UL, SUL or UL+SUL for the indicated cell for the UE */
+           break;
+         case ProtocolIE_ID_id_CUtoDURRCInformation:
+           {
+              if(ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.CUtoDURRCInformation.iE_Extensions)
+              {
+                  duUeCb->f1UeDb->cellGrpCfg = extractCellGrpInfo(ueSetReq->protocolIEs.list.array[ieIdx]->\
+                    value.choice.CUtoDURRCInformation.iE_Extensions, &duUeCb->f1UeDb->duUeCfg);
+                 if(!duUeCb->f1UeDb->cellGrpCfg)
+                 {
+                    DU_LOG("\n F1AP: Failed to extract cell Grp Info");
+                    //TODO: Update the failure cause in ue context Setup Response
+                    ret = RFAILED;
+                 }
+              }
+               break;
+            } 
+         case ProtocolIE_ID_id_SCell_ToBeSetup_List:
+           {
+              DU_LOG("\nDU_APP: Received SCell to be added");
+              DU_LOG("\nDU_APP: Not processing the SCell_ToBeSetup_List");
+           break;
+           }
+         case ProtocolIE_ID_id_SRBs_ToBeSetup_List:
+           {
+              if(extractSrbListToSetup(&ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.SRBs_ToBeSetup_List,\
+                 &duUeCb->f1UeDb->duUeCfg))
+              {
+                 DU_LOG("\nDU_APP: Failed at extractSrbListToSetup()");
+                 //TODO: Update the failure cause in ue context Setup Response
+                 ret = RFAILED;
+              }
+              break;
+           }
+         case ProtocolIE_ID_id_DRBs_ToBeSetup_List:
+           {
+              lcId = getDrbLcId(&duUeCb->drbBitMap);
+              if(lcId != RFAILED)
+              {
+                  if(extractDrbListToSetup(lcId, &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List,\
+                    &duUeCb->f1UeDb->duUeCfg))
+                 {
+                    DU_LOG("\nDU_APP: Failed at extractDrbListToSetup()");
+                    //TODO: Update the failure cause in ue context Setup Response
+                    ret = RFAILED;
+                 }
+              }
+              else 
+                 ret = RFAILED;
+               break;
+           }
+        case ProtocolIE_ID_id_RRCContainer:
+           {
+              duUeCb->f1UeDb->rrcMsgLen = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size;
+              if(duUeCb->f1UeDb->rrcMsgLen > 0)
+              {
+                 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->rrcMsg, duUeCb->f1UeDb->rrcMsgLen);
+                 if(!duUeCb->f1UeDb->rrcMsg)
+                 {
+                    DU_LOG("\nDU APP : Memory allocation failed for RRC Msg in procUeCtxtSetupReq");
+                    ret = RFAILED;
+                 }
+                 else
+                 {
+                    memcpy(duUeCb->f1UeDb->rrcMsg, ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,\
+                       duUeCb->f1UeDb->rrcMsgLen);
+                 }
+              }
+              else
+                 ret = RFAILED;
+              break;
+           }
+        case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
+           {
+              duUeCb->f1UeDb->deliveryStaReq = true;
+              break;
+           }
+        //TODO: To handle maxAggrBitRate case,
+        // Dependency: The protocolIE is not specified in ASN
+#if 0
+        case ProtocolIE_ID_id_ULPDUSessionAggregateMaximumBitRate:            {
+               /* MaximumBitRate Uplink */
+              bitRateSize = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.size;
+              if(bitRateSize > 0)
+              {
+                  DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->duUeCfg.maxAggrBitRate, bitRateSize);
+                 if(!duUeCb->f1UeDb->duUeCfg.maxAggrBitRate)
+                 {
+                    DU_LOG("\nDU APP : Memory allocation failed for bitRate in procUeCtxtSetupReq");
+                    ret = RFAILED;
+                 }
+                 else
+                 {
+                     duUeCb->f1UeDb->duUeCfg.maxAggrBitRate->ulBits =\
+                    *ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.BitRate.buf;
+                     duUeCb->f1UeDb->duUeCfg.maxAggrBitRate->dlBits = 0;
+                 }
+              }
+              else
+                 ret = RFAILED;
+              break;
+           }
+#endif
+        default:
+           {
+              break;
+           }
+      }
+   }
+   if(ret == RFAILED)
+   {
+      /*TODO : Negative case*/
+      // BuildAndSendUeContextSetupRsp(ueIdx, cellId);
+      DU_LOG("F1AP: Failed to process UE CNTXT SETUP REQ at procF1UeContextSetupReq()"); 
+   }
+   else
+      ret = duProcUeContextSetupRequest(duUeCb);
+
+   return ret;
+
+}
+
+/*******************************************************************
+ * @brief Free the memory allocated for UE Setup response
+ *
+ * @details
+ *
+ *    Function : FreeUeContextSetupRsp
+ *
+ *    Functionality:
+ *       Free the memory allocated for UE Setup response
+ *
+ * @params[in] F1AP PDU for UE setup response
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+void FreeUeContextSetupRsp(F1AP_PDU_t *f1apMsg)
+{
+   uint8_t idx;
+   UEContextSetupResponse_t *ueSetRsp = NULLP;
+
+   if(f1apMsg)
+   {
+      if(f1apMsg->choice.successfulOutcome)
+      {
+        ueSetRsp = &f1apMsg->choice.successfulOutcome->value.choice.\
+                   UEContextSetupResponse;
+        if(ueSetRsp->protocolIEs.list.array)
+        {
+           for(idx = 0; idx < ueSetRsp->protocolIEs.list.count; idx++)
+           {
+              if(ueSetRsp->protocolIEs.list.array[idx])
+              {
+                 switch(ueSetRsp->protocolIEs.list.array[idx]->id)
+                 {
+                    case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                       break;
+                    case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                       break;
+                    case ProtocolIE_ID_id_DUtoCURRCInformation:
+                       {
+                          CellGroupConfig_t *cellGrpCfg = NULLP;
+                          cellGrpCfg  = &ueSetRsp->protocolIEs.list.array[idx]->value.choice.\
+                                        DUtoCURRCInformation.cellGroupConfig;
+                          if(cellGrpCfg->buf != NULLP)
+                          {
+                             DU_FREE(cellGrpCfg->buf, cellGrpCfg->size);
+                             cellGrpCfg = NULLP;
+                          }
+                          break;
+                       }
+                    default:
+                       DU_LOG("\nDUAPP: Invalid Id %ld at FreeUeContextSetupRsp()", ueSetRsp->protocolIEs.list.array[idx]->id);
+                       break;
+                 }
+                 DU_FREE(ueSetRsp->protocolIEs.list.array[idx],\
+                       sizeof(UEContextSetupResponseIEs_t));
+              }
+           }
+           DU_FREE(ueSetRsp->protocolIEs.list.array, \
+                 ueSetRsp->protocolIEs.list.size);
+        }
+        DU_FREE(f1apMsg->choice.successfulOutcome, sizeof(SuccessfulOutcome_t));
+      }
+      DU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief Builds Ue context Setup Rsp DU To CU Info
+ *
+ * @details
+ *
+ *    Function : EncodeUeCntxtDuToCuInfo
+ *
+ *    Functionality: Builds Ue context Setup Rsp DU To CU Info
+ *
+ * @params[in] CellGroupConfig_t *, CellGroupConfigRrc_t * 
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ ******************************************************************/
+
+uint8_t EncodeUeCntxtDuToCuInfo(CellGroupConfig_t *duToCuCellGrp, CellGroupConfigRrc_t *duCellGrpCfg)
+{
+   asn_enc_rval_t        encRetVal;
+
+   xer_fprint(stdout, &asn_DEF_CellGroupConfigRrc, duCellGrpCfg);
+   memset((uint8_t *)encBuf, 0, ENC_BUF_MAX_LEN);
+   encBufSize = 0;
+   encRetVal = aper_encode(&asn_DEF_CellGroupConfigRrc, 0, duCellGrpCfg, PrepFinalEncBuf, encBuf);
+   /* Encode results */
+   if(encRetVal.encoded == ENCODE_FAIL)
+   {
+      DU_LOG( "\n F1AP : Could not encode UeCntxtDuToCuInfo (at %s)\n",\
+           encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+      return RFAILED;
+   }
+   else
+   {
+      DU_LOG("\n F1AP : Created APER encoded buffer for UeCntxtDuToCuInfo\n");
+      for(int i=0; i< encBufSize; i++)
+      {
+        printf("%x",encBuf[i]);
+      }
+   }
+   duToCuCellGrp->size = encBufSize;
+   DU_ALLOC(duToCuCellGrp->buf, duToCuCellGrp->size);
+   if(!duToCuCellGrp->buf)
+   {
+      DU_LOG("\nF1AP : Memory allocation failed in UeCntxtDuToCuInfo");
+   }
+   memcpy(duToCuCellGrp->buf, encBuf, duToCuCellGrp->size);
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds and sends the UE Setup Response
+ *
+ * @details
+ *
+ *    Function : BuildAndSendUeContextSetupRsp
+ *
+ *    Functionality: Constructs the UE Setup Response and sends
+ *                   it to the DU through SCTP.
+ *
+ * @params[in] 
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId)
+{
+   uint8_t   idx, ret, cellIdx, elementCnt;
+   uint32_t  gnbCuUeF1apId;   /* gNB-CU UE F1AP Id */
+   uint32_t  gnbDuUeF1apId;   /* gNB-DU UE F1AP Id */
+   asn_enc_rval_t  encRetVal;        /* Encoder return value */
+   F1AP_PDU_t               *f1apMsg = NULLP;
+   UEContextSetupResponse_t *ueSetRsp = NULLP;
+   CellGroupConfigRrc_t     *cellGrpCfg = NULLP;
+   DuUeCb                   *ueCb = NULLP;
+
+   DU_LOG("\n F1AP : Building UE Context Setup Response for cellId %d, ueIdx %d\n", cellId, ueIdx);
+
+   while(true)
+   {
+      DU_ALLOC(f1apMsg, sizeof(F1AP_PDU_t));
+      if(f1apMsg == NULLP)
+      {
+        DU_LOG(" F1AP : Memory allocation for F1AP-PDU failed");
+        ret = RFAILED;
+        break;
+      }
+
+      f1apMsg->present = F1AP_PDU_PR_successfulOutcome;
+      DU_ALLOC(f1apMsg->choice.successfulOutcome,
+           sizeof(SuccessfulOutcome_t));
+      if(f1apMsg->choice.successfulOutcome == NULLP)
+      {
+        DU_LOG(" F1AP : Memory allocation for  F1AP-PDU failed");
+        ret = RFAILED;
+        break;
+      }
+
+      f1apMsg->choice.successfulOutcome->procedureCode = \
+                                                        ProcedureCode_id_UEContextSetup;
+      f1apMsg->choice.successfulOutcome->criticality = Criticality_reject;
+      f1apMsg->choice.successfulOutcome->value.present = \
+                                                        SuccessfulOutcome__value_PR_UEContextSetupResponse;
+
+      ueSetRsp =
+        &f1apMsg->choice.successfulOutcome->value.choice.UEContextSetupResponse;
+      elementCnt = 3;
+      ueSetRsp->protocolIEs.list.count = elementCnt;
+      ueSetRsp->protocolIEs.list.size = \
+                                       elementCnt * sizeof(UEContextSetupResponse_t *);
+
+      /* Initialize the UESetup members */
+      DU_ALLOC(ueSetRsp->protocolIEs.list.array, \
+           ueSetRsp->protocolIEs.list.size);
+      if(ueSetRsp->protocolIEs.list.array == NULLP)
+      {
+        DU_LOG(" F1AP : Memory allocation for UE Setup Response failed");
+        ret = RFAILED;
+        break;
+      }
+
+      for(idx=0; idx<elementCnt; idx++)
+      {
+        DU_ALLOC(ueSetRsp->protocolIEs.list.array[idx],\
+              sizeof(UEContextSetupResponseIEs_t));
+        if(ueSetRsp->protocolIEs.list.array[idx] == NULLP)
+        {
+           DU_LOG(" F1AP : Memory allocation for UE Setup Response failed");
+           ret = RFAILED;
+           break;
+        }
+      }
+      /* Fetching Ue Cb Info*/
+      GET_CELL_IDX(cellId, cellIdx);
+      gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId;
+      gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId;
+      ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1];
+
+      idx = 0;
+      /*GNB CU UE F1AP ID*/
+      ueSetRsp->protocolIEs.list.array[idx]->id        = \
+                                                 ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
+      ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+      ueSetRsp->protocolIEs.list.array[idx]->value.present = \
+                                                            UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
+      ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_CU_UE_F1AP_ID = gnbCuUeF1apId;
+
+      /*GNB DU UE F1AP ID*/
+      idx++;
+      ueSetRsp->protocolIEs.list.array[idx]->id        = \
+                                                 ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
+      ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+      ueSetRsp->protocolIEs.list.array[idx]->value.present = \
+                                                            UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
+      ueSetRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID = gnbDuUeF1apId;
+
+
+      /*DUtoCURRC Information */
+      idx++;
+      ueSetRsp->protocolIEs.list.array[idx]->id  = \
+                                                  ProtocolIE_ID_id_DUtoCURRCInformation;
+      ueSetRsp->protocolIEs.list.array[idx]->criticality = Criticality_reject;
+      ueSetRsp->protocolIEs.list.array[idx]->value.present =\
+                                                           UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation;
+      if(ueCb->f1UeDb)
+      {
+         if(ueCb->f1UeDb->cellGrpCfg)
+        {
+           cellGrpCfg = (CellGroupConfigRrc_t*)ueCb->f1UeDb->cellGrpCfg;
+           ret = EncodeUeCntxtDuToCuInfo(&ueSetRsp->protocolIEs.list.array[idx]->value.\
+                    choice.DUtoCURRCInformation.cellGroupConfig, cellGrpCfg);
+           /* Free UeContext Db created during Ue context Req */
+           freeF1UeDb(ueCb->f1UeDb);
+         }
+      }
+      else
+      {
+         DU_LOG("\nF1AP: Failed to form DUtoCU RRCInfo at BuildAndSendUeContextSetupRsp()");
+         ret = RFAILED;
+      }
+      if(ret == RFAILED)
+         break;
+
+      xer_fprint(stdout, &asn_DEF_F1AP_PDU, f1apMsg);
+
+      /* Encode the UE context setup response type as APER */
+      memset((uint8_t *)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 UE Context Setup Request structure (at %s)\n",\
+              encRetVal.failed_type ? encRetVal.failed_type->name : "unknown");
+        ret = RFAILED;
+        break;
+      }
+      else
+      {
+        DU_LOG("\n F1AP : Created APER encoded buffer for UE Context Setup Request\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 UE Context Setup Request Failed");
+        ret = RFAILED;
+        break;
+      }
+      break;
+   }
+   FreeUeContextSetupRsp(f1apMsg);
+   return ret;
+}/* End of BuildAndSendUeContextSetupRsp */
+
+
+uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId)
+{
+   uint8_t cellIdx = 0, actionType = 0; 
+
+   GET_CELL_IDX(cellId, cellIdx);
+   actionType = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].f1UeDb->actionType;
+
+   switch(actionType)
+   {
+      case UE_CTXT_SETUP:
+         BuildAndSendUeContextSetupRsp(ueIdx, cellId);
+         break;
+      case UE_CTXT_MOD:
+         //TODO: Build Ue context Modification Rsp
+         break;
+      default:
+         DU_LOG("F1AP: Invalid Action Type %d at BuildAndSendUeCtxtRsp()", actionType);
+         break;
+
+   }
+   return ROK;
+}
 
 /*******************************************************************
  *
@@ -6123,7 +8226,7 @@ void F1APMsgHdlr(Buffer *mBuf)
                  }
               case InitiatingMessage__value_PR_UEContextSetupRequest:
                  {
-                    procUeContextSetupReq(f1apMsg);
+                    procF1UeContextSetupReq(f1apMsg);
                     break;
                  }
 
index d187043..cb3c1fd 100644 (file)
@@ -35,7 +35,13 @@ uint8_t BuildAndSendDUConfigUpdate();
 uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti, uint16_t rrcContSize, 
           uint8_t *rrcContainer);
 uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb  ueCb, uint8_t lcId,  uint16_t msgLen, uint8_t *rrcMsg);
-
+uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb);
+uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfg, void *cellGrp);
+void freeUeReCfgCellGrpInfo(MacUeCfg *macUeCfg);
+uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId);
+uint8_t getDrbLcId(uint32_t *drbBitMap);
+void  freeMacLcCfg(LcCfg *lcCfg);
+void  freeRlcLcCfg(RlcBearerCfg *lcCfg);
 /**********************************************************************
          End of file
 **********************************************************************/
index c9b1bc9..cd059c1 100644 (file)
@@ -71,6 +71,13 @@ typedef enum
    UE_ACTIVE
 }UeState;
 
+typedef enum
+{
+   UE_CTXT_UNKNOWN,
+   UE_CTXT_SETUP,
+   UE_CTXT_MOD
+}UeCtxtActionType;
+
 typedef struct cellCfgParams
 {
    NrEcgi      nrEcgi;         /* ECGI */
@@ -80,13 +87,36 @@ typedef struct cellCfgParams
    uint32_t    maxUe;          /* max UE per slot */
 }CellCfgParams;
 
+typedef struct duUeCfg
+{
+   uint8_t numRlcLcs;        /* Rlc Ue Cfg */
+   RlcBearerCfg rlcLcCfg[MAX_NUM_LC];
+   uint8_t numMacLcs;        /* Mac Ue Cfg */
+   LcCfg   macLcCfg[MAX_NUM_LC];
+   MaxAggrBitRate *maxAggrBitRate;
+}DuUeCfg;
+
+typedef struct ueContextSetup
+{
+   UeCtxtActionType actionType;
+   uint8_t  cellIdx;
+   void     *cellGrpCfg;
+   uint16_t rrcMsgLen;
+   uint8_t  *rrcMsg;
+   bool     deliveryStaReq; 
+   DuUeCfg  duUeCfg;          /* Du Ue Cfg */
+}UeContextSetupDb;
+
 typedef struct duUeCb
 {
-   uint32_t    gnbDuUeF1apId; /* GNB DU UE F1AP ID */
-   uint32_t    gnbCuUeF1apId; /* GNB CU UE F1AP ID */
-   UeState     ueState;
-   MacUeCfg    macUeCfg;
-   RlcUeCfg    rlcUeCfg;
+   uint16_t crnti;
+   uint32_t gnbDuUeF1apId;   /* GNB DU UE F1AP ID */
+   uint32_t gnbCuUeF1apId;   /* GNB CU UE F1AP ID */
+   uint32_t drbBitMap;       /* Drb Bit Map */
+   UeState  ueState;         /* UE Active/ Ue Inactive state */
+   MacUeCfg macUeCfg;        /* Mac Ue Cfg */
+   RlcUeCfg rlcUeCfg;        /* Rlc Ue Cfg */
+   UeContextSetupDb *f1UeDb;
 }DuUeCb;
 
 typedef struct duCellCb
index 76fabd6..1ba3f77 100644 (file)
@@ -168,9 +168,14 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf)
                  {
                     break;
                  }
-              case EVENT_RLC_UL_UE_CREATE_RSP:
+              case EVENT_RLC_UE_CONFIG_RSP:
                  {
-                    ret = unpackRlcUlUeCreateRsp(DuProcRlcUlUeCreateRsp, pst, mBuf);
+                    ret = unpackRlcUeCfgRsp(DuProcRlcUeCfgRsp, pst, mBuf);
+                    break;
+                 }
+              case EVENT_RLC_UE_RECONFIG_RSP:
+                 {
+                    ret = unpackRlcUeCfgRsp(DuProcRlcUeCfgRsp, pst, mBuf);
                     break;
                  }
               case EVENT_UL_RRC_MSG_TRANS_TO_DU:
@@ -237,9 +242,14 @@ uint8_t duActvTsk(Pst *pst, Buffer *mBuf)
                     ret = unpackMacUlCcchInd(duHandleUlCcchInd, pst, mBuf);
                     break;
                  }
-              case EVENT_MAC_UE_CREATE_RSP:
+              case EVENT_MAC_UE_CONFIG_RSP:
+                 {
+                    ret = unpackDuMacUeCfgRsp(DuProcMacUeCfgRsp, pst, mBuf); 
+                    break;
+                 }
+               case EVENT_MAC_UE_RECONFIG_RSP:
                  {
-                    ret = unpackDuMacUeCreateRsp(DuHandleMacUeCreateRsp, pst, mBuf); 
+                    ret = unpackDuMacUeCfgRsp(DuProcMacUeCfgRsp, pst, mBuf); 
                     break;
                  }
 
index 21c2059..3545e6e 100644 (file)
@@ -51,14 +51,14 @@ DuMacUeCreateReq packMacUeCreateReqOpts[] =
 {
    packDuMacUeCreateReq,       /* Loose coupling */
    MacProcUeCreateReq,          /* TIght coupling */
-   packDuMacUeCreateReq,       /* Light weight-loose coupling */
+   packDuMacUeCreateReq       /* Light weight-loose coupling */
 };
 
-DuRlcUlUeCreateReq packRlcUlUeCreateReqOpts[] =
+DuRlcUeCreateReq packRlcUeCreateReqOpts[] =
 {
-   packDuRlcUlUeCreateReq,       /* Loose coupling */
-   RlcUlProcUeCreateReq,          /* TIght coupling */
-   packDuRlcUlUeCreateReq,       /* Light weight-loose coupling */
+   packDuRlcUeCreateReq,       /* Loose coupling */
+   RlcProcUeCreateReq,          /* TIght coupling */
+   packDuRlcUeCreateReq       /* Light weight-loose coupling */
 };
 
 DuDlRrcMsgToRlcFunc duSendDlRrcMsgToRlcOpts[] =
@@ -68,6 +68,19 @@ DuDlRrcMsgToRlcFunc duSendDlRrcMsgToRlcOpts[] =
    packDlRrcMsgToRlc           /* Light weight-loose coupling */
 };
 
+DuRlcUeReconfigReq packRlcUeReconfigReqOpts[] =
+{
+   packDuRlcUeReconfigReq,       /* Loose coupling */
+   RlcProcUeReconfigReq,       /* TIght coupling */
+   packDuRlcUeReconfigReq       /* Light weight-loose coupling */
+};
+
+DuMacUeReconfigReq packMacUeReconfigReqOpts[] =
+{
+   packDuMacUeReconfigReq,       /* Loose coupling */
+   MacProcUeReconfigReq,       /* TIght coupling */
+   packDuMacUeReconfigReq     /* Light weight-loose coupling */
+};
 /*******************************************************************
  *
  * @brief Handles EGTP data from CU 
@@ -141,7 +154,6 @@ uint8_t duBuildAndSendDlCcchInd(uint16_t *cellId, uint16_t *crnti, \
    uint16_t idx2;
    DlCcchIndInfo *dlCcchIndInfo = NULLP;
    Pst pst;
-   memset(&pst, 0, sizeof(Pst));
 
    DU_LOG("\nDU APP : Building and Sending DL CCCH Ind to MAC");
 
@@ -230,12 +242,12 @@ uint8_t duBuildAndSendDlRrcMsgToRlc(uint16_t cellId, RlcUeCfg ueCfg, \
    dlRrcMsgInfo->ueIdx = ueCfg.ueIdx;
    for(lcIdx = 0; lcIdx <= MAX_NUM_LC; lcIdx++)
    {
-      if(ueCfg.rlcBearerCfg[lcIdx].lcId == lcId)
+      if(ueCfg.rlcLcCfg[lcIdx].lcId == lcId)
       {
-         dlRrcMsgInfo->rbType = ueCfg.rlcBearerCfg[lcIdx].rbType;
-         dlRrcMsgInfo->rbId = ueCfg.rlcBearerCfg[lcIdx].rbId;
-        dlRrcMsgInfo->lcType = ueCfg.rlcBearerCfg[lcIdx].lcType;
-         dlRrcMsgInfo->lcId = ueCfg.rlcBearerCfg[lcIdx].lcId;
+         dlRrcMsgInfo->rbType = ueCfg.rlcLcCfg[lcIdx].rbType;
+         dlRrcMsgInfo->rbId = ueCfg.rlcLcCfg[lcIdx].rbId;
+        dlRrcMsgInfo->lcType = ueCfg.rlcLcCfg[lcIdx].lcType;
+         dlRrcMsgInfo->lcId = ueCfg.rlcLcCfg[lcIdx].lcId;
         break;
       }
    }
@@ -245,7 +257,6 @@ uint8_t duBuildAndSendDlRrcMsgToRlc(uint16_t cellId, RlcUeCfg ueCfg, \
    dlRrcMsgInfo->msgLen = rrcMsgLen;
 
    /* Filling post structure and sending msg */ 
-   memset(&pst, 0, sizeof(Pst));
    FILL_PST_DUAPP_TO_RLC(pst, RLC_DL_INST, EVENT_DL_RRC_MSG_TRANS_TO_RLC);
    ret = (*duSendDlRrcMsgToRlcOpts[pst.selector])(&pst, dlRrcMsgInfo);
    if(ret != ROK)
@@ -258,116 +269,7 @@ uint8_t duBuildAndSendDlRrcMsgToRlc(uint16_t cellId, RlcUeCfg ueCfg, \
    return ROK;
 } 
 
-/*******************************************************************
- *
- * @brief Process UE context setup request from CU
- *
- * @details
- *
- *    Function : procUeCintextSetupReq
- *
- *    Functionality: Process UE context setup request from CU
- *
- * @params[in] F1AP message
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-uint8_t procUeContextSetupReq(F1AP_PDU_t *f1apMsg)
-{
-   uint8_t    ret = ROK;
-   uint8_t    ieIdx, ueIdx;
-   uint8_t    *rrcMsg = NULLP;
-   uint16_t   rrcMsgLen;
-   uint16_t   cellId, cellIdx;
-   uint32_t   gnbDuUeF1apId;    /* GNB DU UE F1AP ID */
-   uint32_t   gnbCuUeF1apId;    /* GNB CU UE F1AP ID */
-   bool       deliveryStaReq = false;   /* RRC msg delivery status request */
-   DuUeCb     *ueCb = NULLP;
-   UEContextSetupRequest_t   *ueSetReq = NULLP;
-  
-   ueSetReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextSetupRequest;
-
-   /* TODO : fetch remaining values from f1ap msg */
-   for(ieIdx=0; ieIdx < ueSetReq->protocolIEs.list.count; ieIdx++)
-   {
-      switch(ueSetReq->protocolIEs.list.array[ieIdx]->id)
-      {
-         case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
-           {
-              gnbCuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_CU_UE_F1AP_ID;
-              break;
-            }
-        case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
-           {
-              gnbDuUeF1apId = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID;
-              break;
-           }
-         case ProtocolIE_ID_id_ServCellIndex:
-           {
-              cellIdx = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.ServCellIndex;
-              break;
-           }
-         case ProtocolIE_ID_id_RRCContainer: 
-            {
-               rrcMsgLen = ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size;
-              if(rrcMsgLen <= 0)
-              {
-                 DU_LOG("\nDU APP : Invalid RRC Msg Length %d in Ue Ctxt Setup Req", rrcMsgLen);
-                 return RFAILED;
-              }
-               DU_ALLOC_SHRABL_BUF(rrcMsg, rrcMsgLen);
-              if(!rrcMsg)
-              {
-                 DU_LOG("\nDU APP : Memory allocation failed for RRC Msg in procUeCtxtSetupReq");
-                 return RFAILED;
-              }
-              memcpy(rrcMsg, ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf,\
-                 rrcMsgLen);
-              break;
-            }
-         case ProtocolIE_ID_id_RRCDeliveryStatusRequest:
-           {
-               deliveryStaReq = true;         
-              break;
-           }
-        default:
-           {
-              break;
-           }
-      }
-   }
-
-   cellId = duCb.actvCellLst[cellIdx]->cellId;
-   for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
-   {
-      if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId) &&
-         (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId &&
-        duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState == UE_ACTIVE))
-      {
-         ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
-        break;
-      }
-   }
-
-   /* TODO :  send RB config to MAC/RLC */
-
-   /* Sending DL RRC Message to RLC */
-   if(ueIdx != MAX_NUM_UE)
-   {
-      ret = duBuildAndSendDlRrcMsgToRlc(cellId, ueCb->rlcUeCfg, SRB1_LCID, \
-               false, deliveryStaReq,  rrcMsgLen, rrcMsg); 
-   }
-   else
-   {
-      DU_LOG("\nDU APP : No UE found for CuUeF1apId[%d] and DuUeF1apId[%d]", \
-         gnbCuUeF1apId, gnbDuUeF1apId);
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rrcMsg, rrcMsgLen);
-      ret = RFAILED;
-   }
 
-   return ret;
-}
 
 /******************************************************************
  *
@@ -479,25 +381,25 @@ uint8_t procDlRrcMsgTrans(F1AP_PDU_t *f1apMsg)
    if(ueCcchCtxtFound)
    {
       ret = duBuildAndSendDlCcchInd(&cellId, &crnti, RRC_SETUP, rrcMsgSize, rrcMsgPdu);
-      if(ret)
+      if(ret == RFAILED)
       {
-        DU_LOG("\nDU_APP: Falied at duBuildAndSendDlCcchInd()");
+        DU_LOG("\nDU_APP: Falied to build DlCcch Ind at procDlRrcMsgTrans()");
       }
       else
       {
         if(duCb.actvCellLst[cellId-1]->numActvUes < MAX_NUM_UE)
         {
            ret = duCreateUeCb(&duCb.ueCcchCtxt[ueIdx], gnbCuUeF1apId);
-           if(ret)
+           if(ret == RFAILED)
            {
-              DU_LOG("\nDU_APP: Failed at duCreateUeCb for cellId [%d]", \
+              DU_LOG("\nDU_APP: Failed to createUeCb for cellId [%d] at procDlRrcMsgTrans()", \
                     duCb.ueCcchCtxt[ueIdx].cellId);
               ret = RFAILED;
            }
         }
         else
         {
-           DU_LOG("\nDU_APP: Max Active UEs has reached");
+           DU_LOG("\nDU_APP: Max Active UEs has reached at procDlRrcMsgTrans()");
            ret = RFAILED;
         }
       }
@@ -592,19 +494,40 @@ uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo)
 
 }
 
+/******************************************************************
+ *
+ * @brief Fills Default UL LC Cfg
+ *
+ * @details
+ *
+ *    Function : fillDefaultUlLcCfg
+ *
+ *    Functionality: Fills Default UL LC Cfg
+ *
+ *
+ *****************************************************************/
+void fillDefaultUlLcCfg(UlLcCfg *ulLcCfg)
+{
+   ulLcCfg->priority = LC_PRIORITY_1;
+   ulLcCfg->lcGroup =  0;
+   ulLcCfg->schReqId = 0;
+   ulLcCfg->pbr = PBR_KBPS_INFINITY;
+   ulLcCfg->bsd = BSD_MS_1000;
+}
+
 /******************************************************************
  *
  * @brief Fills Initial DL Bandwidth Part
  *
  * @details
  *
- *    Function : fillInitDlBwp
+ *    Function : fillDefaultInitDlBwp
  *
  *    Functionality: Fills Initial DL Bandwidth Part
  *
  *
  *****************************************************************/
-void fillInitDlBwp(InitialDlBwp *initDlBwp)
+void fillDefaultInitDlBwp(InitialDlBwp *initDlBwp)
 {
    uint8_t idx = 0;
    uint8_t freqDomainResource[FREQ_DOM_RSRC_SIZE] = {0};
@@ -629,7 +552,7 @@ void fillInitDlBwp(InitialDlBwp *initDlBwp)
            coreset1StartPrb = coreset0EndPrb +6;
            coreset1NumPrb = CORESET1_NUM_PRB;
            /* calculate the PRBs */
-           schAllocFreqDomRscType0(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
+           freqDomRscAllocType0(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
            memcpy(initDlBwp->pdcchCfg.cRSetToAddModList[idx].freqDomainRsrc, freqDomainResource,
               FREQ_DOM_RSRC_SIZE);
 
@@ -693,6 +616,7 @@ void fillInitDlBwp(InitialDlBwp *initDlBwp)
         initDlBwp->pdschCfg.rbgSize = RBG_SIZE_CONFIG1;
         initDlBwp->pdschCfg.numCodeWordsSchByDci = CODEWORDS_SCHED_BY_DCI_N1;
         initDlBwp->pdschCfg.bundlingType = TYPE_STATIC_BUNDLING;
+        initDlBwp->pdschCfg.bundlingInfo.StaticBundling.size = 0;
       }
    }
 
@@ -704,13 +628,13 @@ void fillInitDlBwp(InitialDlBwp *initDlBwp)
  *
  * @details
  *
- *    Function : fillInitUlBwp
+ *    Function : fillDefaultInitUlBwp
  *
  *    Functionality: Fills Initial UL Bandwidth Part
  *
  *
  *****************************************************************/
-void fillInitUlBwp(InitialUlBwp *initUlBwp)
+void fillDefaultInitUlBwp(InitialUlBwp *initUlBwp)
 {
    uint8_t idx;
    if(initUlBwp)
@@ -721,6 +645,7 @@ void fillInitUlBwp(InitialUlBwp *initUlBwp)
       initUlBwp->puschPresent = TRUE;
       if(initUlBwp->puschPresent)
       {
+         initUlBwp->puschCfg.dataScramblingId = SCRAMBLING_ID;
         initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.addPos = ADDITIONALPOSITION_POS0; 
         initUlBwp->puschCfg.dmrsUlCfgForPuschMapTypeA.transPrecodDisabled. \
            scramblingId0 = SCRAMBLING_ID; 
@@ -752,19 +677,19 @@ void fillInitUlBwp(InitialUlBwp *initUlBwp)
  *
  * @details
  *
- *    Function : fillSpCellGrpInfo
+ *    Function : fillDefaultSpCellGrpInfo
  *
  *    Functionality: Fills Sp Cell Group Info
  *
  *
  *****************************************************************/
-void fillSpCellGrpInfo(SpCellCfg *spCell)
+void fillDefaultSpCellGrpInfo(SpCellCfg *spCell)
 {
    if(spCell)
    {
       spCell->servCellIdx = SERV_CELL_IDX;
       /* Filling Initial Dl Bwp */
-      fillInitDlBwp(&spCell->servCellCfg.initDlBwp);
+      fillDefaultInitDlBwp(&spCell->servCellCfg.initDlBwp);
 
       spCell->servCellCfg.numDlBwpToAdd    = 0; 
       spCell->servCellCfg.firstActvDlBwpId = ACTIVE_DL_BWP_ID;
@@ -777,7 +702,7 @@ void fillSpCellGrpInfo(SpCellCfg *spCell)
       spCell->servCellCfg.pdschServCellCfg.numHarqProcForPdsch =\
          NUM_HARQ_PROC_FOR_PDSCH_N_16;
       /* Filling Initial UL Bwp*/
-      fillInitUlBwp(&spCell->servCellCfg.initUlBwp);
+      fillDefaultInitUlBwp(&spCell->servCellCfg.initUlBwp);
       spCell->servCellCfg.numUlBwpToAdd     = 0; 
       spCell->servCellCfg.firstActvUlBwpId  = ACTIVE_DL_BWP_ID; 
    }
@@ -793,13 +718,13 @@ void fillSpCellGrpInfo(SpCellCfg *spCell)
  *
  * @details
  *
- *    Function : fillPhyCellGrpInfo
+ *    Function : fillDefaultPhyCellGrpInfo
  *
  *    Functionality: Fills Physical Cell Group Info
  *
  *
  *****************************************************************/
-void fillPhyCellGrpInfo(PhyCellGrpCfg *cellGrp)
+void fillDefaultPhyCellGrpInfo(PhyCellGrpCfg *cellGrp)
 {
    if(cellGrp)
    {
@@ -818,13 +743,13 @@ void fillPhyCellGrpInfo(PhyCellGrpCfg *cellGrp)
  *
  * @details
  *
- *    Function : fillMacCellGrpInfo
+ *    Function : fillDefaultMacCellGrpInfo
  *
  *    Functionality: Fills Mac Cell Group Info
  *
  *
  *****************************************************************/
-void fillMacCellGrpInfo(MacCellGrpCfg *cellGrp)
+void fillDefaultMacCellGrpInfo(MacCellGrpCfg *cellGrp)
 {
    uint8_t idx;
 
@@ -856,9 +781,9 @@ void fillMacCellGrpInfo(MacCellGrpCfg *cellGrp)
       cellGrp->tagCfg.relListCount = 0;
 
       /* Filling BSR config */
-      cellGrp->bsrTmrCfg.periodicTimer = PERIODIC_BSR_TMR;
-      cellGrp->bsrTmrCfg.retxTimer = RETX_BSR_TMR;
-      cellGrp->bsrTmrCfg.srDelayTimer = SR_DELAY_TMR;
+      cellGrp->bsrTmrCfg.periodicTimer = BSR_PERIODIC_TIMER_SF_10;
+      cellGrp->bsrTmrCfg.retxTimer = BSR_RETX_TIMER_SF_320;
+      cellGrp->bsrTmrCfg.srDelayTimer = BSR_SR_DELAY_TMR_2560;
 
       /* Filling PHR config */
       cellGrp->phrCfgSetupPres = true;
@@ -877,67 +802,201 @@ void fillMacCellGrpInfo(MacCellGrpCfg *cellGrp)
    }
 }
 
+
+
+void fillMacSrb1LcCfg(LcCfg *macLcCfg)
+{
+   macLcCfg->lcId   = SRB1_LCID;
+   macLcCfg->configType = CONFIG_ADD;
+   macLcCfg->drbQos = NULLP;
+   macLcCfg->snssai = NULLP;
+   macLcCfg->ulLcCfgPres = true;
+   fillDefaultUlLcCfg(&macLcCfg->ulLcCfg);
+}
+
 /******************************************************************
  *
- * @brief Fills Logical Channel Config List
+ * @brief Function to fill the Lc cfg from ueSetupReqDb
  *
  * @details
  *
- *    Function : fillLcCfgList
+ *    Function : fillMacLcCfgToAddMod
  *
- *    Functionality: Fills Logical channel Config List
+ *    Functionality: Function to fill the Lc cfg from ueSetupReqDb
  *
  *
  *****************************************************************/
-void fillLcCfgList(LcCfg *lcCfgInfo)
+
+uint8_t fillMacLcCfgToAddMod(LcCfg *lcCfg, LcCfg *ueSetReqDb)
 {
-   if(lcCfgInfo)
+   uint8_t ret = ROK; 
+   lcCfg->lcId = ueSetReqDb->lcId;
+   lcCfg->configType = ueSetReqDb->configType;
+   /* Filling DRBQOS */
+   if(ueSetReqDb->drbQos)
    {
-      lcCfgInfo->lcId = SRB1_LCID;
-      lcCfgInfo->drbQos = NULLP;
-      lcCfgInfo->snssai = NULLP;
-      lcCfgInfo->ulLcCfg = NULLP;
-      lcCfgInfo->dlLcCfg.lcp = LC_PRIORITY_1;
-
-#if 0
-      /* TODO: To be filled on receving UE CONTEXT SETUP from CU */
-      /* Filling Qos characteristics */
-      lcCfgInfo->drbQos.fiveQiType = QoS_Characteristics_PR_non_Dynamic_5QI;
-      lcCfgInfo->drbQos.u.nonDyn5Qi.fiveQi = 0;
-      lcCfgInfo->drbQos.u.nonDyn5Qi.priorLevel = 0;
-      lcCfgInfo->drbQos.u.nonDyn5Qi.avgWindow = 0;
-      lcCfgInfo->drbQos.u.nonDyn5Qi.maxDataBurstVol = 0;
-
-      /* Filling NgRAN */
-      lcCfgInfo->drbQos.ngRanRetPri.priorityLevel = PriorityLevel_highest;
-      lcCfgInfo->drbQos.ngRanRetPri.preEmptionCap = \
-                                                   Pre_emptionCapability_may_trigger_pre_emption;
-      lcCfgInfo->drbQos.ngRanRetPri.preEmptionVul = \
-                                                   Pre_emptionVulnerability_not_pre_emptable;
-
-      /* Filling Grb Qos */
-      lcCfgInfo->drbQos.grbQosInfo.maxFlowBitRateDl  = 0;
-      lcCfgInfo->drbQos.grbQosInfo.maxFlowBitRateUl  = 0;
-      lcCfgInfo->drbQos.grbQosInfo.guarFlowBitRateDl = 0;
-      lcCfgInfo->drbQos.grbQosInfo.guarFlowBitRateUl = 0;
-
-      /* Filling S-NSSAI */
-      /* TODO :To be filled when UE Context Setup Request is sent from CU */
-      /* Filling UL Logical Channel Config */
-      lcCfgInfo->ulLcCfg.priority = 0;
-      lcCfgInfo->ulLcCfg.lcGroup  = 0;
-      lcCfgInfo->ulLcCfg.schReqId = 0;
-      lcCfgInfo->ulLcCfg.pbr = 0;
-      lcCfgInfo->ulLcCfg.bsd = 0;
-
-      /* Filling DL Logical Channel Config */
-      lcCfgInfo->dlLcCfg.lcp = 0;
-#endif
+      if(!lcCfg->drbQos)
+      {
+         DU_ALLOC_SHRABL_BUF(lcCfg->drbQos, sizeof(DrbQosInfo));
+         if(!lcCfg->drbQos)
+         {
+            DU_LOG("\nDU APP: Memory Alloc failed at drQos at fillMacLcCfgToAddMod()");
+            ret = RFAILED;
+         }
+      }
+      if(ret == ROK)
+      {
+         memcpy(lcCfg->drbQos, ueSetReqDb->drbQos, sizeof(DrbQosInfo));
+      }
+   }
+   else
+   {
+      lcCfg->drbQos = NULLP;
+   }
+
+   /* Filling SNSSAI */
+   if(ueSetReqDb->snssai && ret == ROK)
+   {
+      if(!lcCfg->snssai)
+      {
+         DU_ALLOC_SHRABL_BUF(lcCfg->snssai, sizeof(Snssai));
+         if(!lcCfg->snssai)
+         {
+            DU_LOG("\nDU APP: Memory Alloc failed at snnsai at fillMacLcCfgToAddMod()");
+            ret = RFAILED;
+         }
+      }
+      if(ret == ROK)
+      {
+         memcpy(lcCfg->snssai, ueSetReqDb->snssai, sizeof(Snssai));
+      }
+   }
+   else
+   {
+      lcCfg->snssai = NULLP;
+      if(lcCfg->drbQos)
+      {
+         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->drbQos, sizeof(DrbQosInfo));
+         lcCfg->drbQos = NULLP;
+      }
+   }
+   lcCfg->ulLcCfgPres = ueSetReqDb->ulLcCfgPres;
+   memcpy(&lcCfg->ulLcCfg, &ueSetReqDb->ulLcCfg, sizeof(UlLcCfg));
+   memcpy(&lcCfg->dlLcCfg, &ueSetReqDb->dlLcCfg, sizeof(DlLcCfg));
+   return ret;
+}
+
+/******************************************************************
+ *
+ * @brief Function to copy the Bit rate from ueSetupReqDb
+ *
+ * @details
+ *
+ *    Function : getMaxAggrBitRate
+ *
+ *    Functionality: Function to copy bit Rate from ueSetupReqDb
+ *
+ *
+ *****************************************************************/
+
+uint8_t getMaxAggrBitRate(MaxAggrBitRate *macBitRate, MaxAggrBitRate *ueDbBitRate)
+{
+   if(ueDbBitRate)
+   {
+      if(!macBitRate)
+      {
+         DU_ALLOC_SHRABL_BUF(macBitRate, sizeof(MaxAggrBitRate));
+         if(!macBitRate)
+         {
+            DU_LOG("\nDUAPP: Memory Alloc Failed at getMaxAggrBitRate()");
+            return RFAILED;
+         }
+      }
+      memcpy(macBitRate, ueDbBitRate, sizeof(MaxAggrBitRate));
+   }
+   else
+   {
+      macBitRate = NULLP;
+   }
+   return ROK;
+}
+
+/******************************************************************
+ *
+ * @brief Builds and Send UE ReConfig Request to MAC
+ *
+ * @details
+ *
+ *    Function : sendUeReCfgReqToMac
+ *
+ *    Functionality: Builds and Send UE ReConfig Request to MAC
+ *
+ * @Params[in]  MacUeCfg *
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t sendUeReCfgReqToMac(MacUeCfg *macUeCfg)
+{
+   uint8_t ret = ROK;
+   Pst pst;
+   
+   /* Fill Pst */
+   FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_RECONFIG_REQ);
+   
+   if(macUeCfg)
+   {
+      /* Processing one Ue at a time to MAC */
+      DU_LOG("\nDU_APP: Sending Reconfig Request to MAC");
+      ret = (*packMacUeReconfigReqOpts[pst.selector])(&pst, macUeCfg);
+      if(ret == RFAILED)
+      {
+         DU_LOG("\nDU_APP: Failed to send Reconfig Request to MAC at sendUeReCfgReqToMac()");
+        DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
+      }
    }
    else
    {
-      DU_LOG("\n Memory is null for LcCfgList");
+      DU_LOG("\n DU_APP: Received macUeCfg is NULLP at sendUeReCfgReqToMac()");
+      ret = RFAILED;
+   }
+   return ret;
+}
+
+/******************************************************************
+ *
+ * @brief Function to return Drb LcId
+ *
+ * @details
+ *
+ *    Function : getDrbLcId
+ *
+ *    Functionality: Function to return Drb LcId
+ *
+ *Returns: lcId - SUCCESS
+ *         RFAILED - FAILURE
+ *****************************************************************/
+
+uint8_t getDrbLcId(uint32_t *drbBitMap)
+{
+   uint8_t bitMask = 1, bitPos = 0;
+   bitPos = MIN_DRB_LCID;
+
+   while(bitPos <= MAX_DRB_LCID)
+   {
+      if((*drbBitMap & (bitMask << bitPos)) == 0)
+      {
+        *drbBitMap = ((bitMask << bitPos)| *drbBitMap);
+        return bitPos;
+      }
+      else
+      {
+        bitPos++;
+      }
    }
+   DU_LOG("\nDU_APP: Max LC Reached in getDrbLcId()");
+   return RFAILED;
 }
 
 /******************************************************************
@@ -952,31 +1011,83 @@ void fillLcCfgList(LcCfg *lcCfgInfo)
  *
  *
  *****************************************************************/
-void fillMacUeCfg(uint16_t cellId, uint8_t ueIdx,\
-  uint16_t crnti, MacUeCfg *ueCfg)
+uint8_t fillMacUeCfg(uint16_t cellId, uint8_t ueIdx, uint16_t crnti, \
+   UeContextSetupDb *ueCfgDb, MacUeCfg *macUeCfg)
 {
-   uint8_t idx;
-   ueCfg->cellId       = cellId;
-   ueCfg->ueIdx        = ueIdx;
-   ueCfg->crnti        = crnti;
-   /* Filling MacCellGroup Config */ 
-   fillMacCellGrpInfo(&ueCfg->macCellGrpCfg);
-   /* Filling PhyCellGroup Config */ 
-   fillPhyCellGrpInfo(&ueCfg->phyCellGrpCfg);
-   /* Filling SpCellGroup Config */ 
-   fillSpCellGrpInfo(&ueCfg->spCellCfg);
-   /* Filling AMBR for UL and DL */ 
-   ueCfg->maxAggrBitRate = NULLP;
-   /* Filling LC Context */
-   ueCfg->numLcs = SRB1_LCID;
-   if(ueCfg->numLcs < MAX_NUM_LC)
+   uint8_t ret, dbIdx, lcIdx, cellIdx;
+   bool lcIdFound = false;
+   MacUeCfg *duMacDb = NULLP;
+
+   ret =ROK;
+
+   if(!ueCfgDb)
    {
-      for(idx = 0; idx < ueCfg->numLcs; idx++)
-      {   
-        fillLcCfgList(&ueCfg->lcCfgList[idx]);
-      }
+      macUeCfg->cellId       = cellId;
+      macUeCfg->ueIdx        = ueIdx;
+      macUeCfg->crnti        = crnti;
+      fillDefaultMacCellGrpInfo(&macUeCfg->macCellGrpCfg);
+      fillDefaultPhyCellGrpInfo(&macUeCfg->phyCellGrpCfg);
+      fillDefaultSpCellGrpInfo(&macUeCfg->spCellCfg);
+      macUeCfg->maxAggrBitRate = NULLP;
+      fillMacSrb1LcCfg(&macUeCfg->lcCfgList[0]);
+      macUeCfg->numLcs++;
    }
+   else
+   {
+      /* Fetching MacDb from DuUeCb */
+      GET_CELL_IDX(cellId, cellIdx);
+      duMacDb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg;
+      /* Fetching MaUeCfg List for ADD/MOD/DEL */
+      macUeCfg->cellId       = cellId;
+      macUeCfg->ueIdx        = ueIdx;
+      macUeCfg->crnti        = crnti;
+      ret = procUeReCfgCellInfo(macUeCfg, ueCfgDb->cellGrpCfg);
+      if(ret == ROK)
+      {
+        ret = getMaxAggrBitRate(macUeCfg->maxAggrBitRate, ueCfgDb->duUeCfg.maxAggrBitRate);
+      }
 
+      /* Filling LC Context */
+      for(dbIdx = 0; (dbIdx < ueCfgDb->duUeCfg.numMacLcs && ret == ROK); dbIdx++)
+      {
+        if(!ueCfgDb->duUeCfg.macLcCfg[dbIdx].ulLcCfgPres)
+        {
+           /* Filling default UL LC config in MAC if not present */
+           ueCfgDb->duUeCfg.macLcCfg[dbIdx].ulLcCfgPres = true;
+           fillDefaultUlLcCfg(&ueCfgDb->duUeCfg.macLcCfg[dbIdx].ulLcCfg);
+        }
+        for(lcIdx = 0; lcIdx < duMacDb->numLcs; lcIdx++)
+        {
+           if(ueCfgDb->duUeCfg.macLcCfg[dbIdx].lcId == duMacDb->lcCfgList[lcIdx].lcId)
+           {
+              lcIdFound = true;
+              if((ueCfgDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_UNKNOWN) ||
+                    (ueCfgDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_MOD))
+              {
+                 ueCfgDb->duUeCfg.macLcCfg[dbIdx].configType = CONFIG_MOD;
+                 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->duUeCfg.macLcCfg[dbIdx]);
+              }
+           }
+           else
+              lcIdFound = false;
+        }
+        if(!lcIdFound)
+        {
+           /* ADD/DEL CONFIG */
+           ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[dbIdx], &ueCfgDb->duUeCfg.macLcCfg[dbIdx]);
+        }
+        if(ret == ROK)
+        {
+           macUeCfg->numLcs++;
+        }
+        else
+        {
+           DU_LOG("\n DU_APP: Failed to add Lc at Idx %d in fillMacUeCfg()", dbIdx); 
+           break;
+        }
+      }/*End of Outer FOR loop */
+   }
+   return ret;
 }
 
 /******************************************************************
@@ -985,13 +1096,13 @@ void fillMacUeCfg(uint16_t cellId, uint8_t ueIdx,\
  *
  * @details
  *
- *    Function : fillAmInfo
+ *    Function : fillDefaultAmInfo
  *
  *    Functionality: Fills Rlc AM Information
  *
  *
  *****************************************************************/
-void fillAmInfo(AmBearerCfg *amCfg)
+void fillDefaultAmInfo(AmBearerCfg *amCfg)
 {
    /* DL AM */
    amCfg->dlAmCfg.snLenDl     = AM_SIZE_12;
@@ -1004,7 +1115,6 @@ void fillAmInfo(AmBearerCfg *amCfg)
    amCfg->ulAmCfg.snLenUl     = AM_SIZE_12;
    amCfg->ulAmCfg.reAssemTmr  = RE_ASM_40MS; 
    amCfg->ulAmCfg.statProhTmr = PROH_35MS;
-
 }
 
 /******************************************************************
@@ -1013,13 +1123,13 @@ void fillAmInfo(AmBearerCfg *amCfg)
  *
  * @details
  *
- *    Function : fillUmBiDirInfo
+ *    Function : fillDefaultUmBiInfo
  *
  *    Functionality: Fills RLC UM Bi Directional Information
  *
  *
  *****************************************************************/
-void fillUmBiDirInfo(UmBiDirBearerCfg *umBiDirCfg)
+void fillDefaultUmBiInfo(UmBiDirBearerCfg *umBiDirCfg)
 {
    /* UL UM BI DIR INFO */
    umBiDirCfg->ulUmCfg.snLenUlUm = UM_SIZE_12;
@@ -1027,7 +1137,6 @@ void fillUmBiDirInfo(UmBiDirBearerCfg *umBiDirCfg)
 
    /* DL UM BI DIR INFO */
    umBiDirCfg->dlUmCfg.snLenDlUm  = UM_SIZE_12;
-
 }
 
 /******************************************************************
@@ -1036,16 +1145,16 @@ void fillUmBiDirInfo(UmBiDirBearerCfg *umBiDirCfg)
  *
  * @details
  *
- *    Function : fillUmUniDirUlInfo
+ *    Function : fillDefaultUmUlInfo
  *
  *    Functionality: Fills RLC UM Uni Directional Info
  *
  *
  *****************************************************************/
-void fillUmUniDirUlInfo(UmUniDirUlBearerCfg *umUniDirUlCfg)
+void fillDefaultUmUlInfo(UmUniDirUlBearerCfg *UmUlCfg)
 {
-   umUniDirUlCfg->ulUmCfg.snLenUlUm = UM_SIZE_12;
-   umUniDirUlCfg->ulUmCfg.reAssemTmr = RE_ASM_40MS;
+   UmUlCfg->ulUmCfg.snLenUlUm = UM_SIZE_12;
+   UmUlCfg->ulUmCfg.reAssemTmr = RE_ASM_40MS;
 }
 
 /******************************************************************
@@ -1054,88 +1163,229 @@ void fillUmUniDirUlInfo(UmUniDirUlBearerCfg *umUniDirUlCfg)
  *
  * @details
  *
- *    Function : fillUmUniDirDlInfo
+ *    Function : fillDefaultUmDlInfo
  *
  *    Functionality: Fills RLC UM Uni Directional DL Info
  *
  *
  *****************************************************************/
-void fillUmUniDirDlInfo(UmUniDirDlBearerCfg *umUniDirDlCfg)
+void fillDefaultUmDlInfo(UmUniDirDlBearerCfg *UmDlCfg)
 {
-   umUniDirDlCfg->dlUmCfg.snLenDlUm  = UM_SIZE_12;
+   UmDlCfg->dlUmCfg.snLenDlUm  = UM_SIZE_12;
 }
 
 /******************************************************************
  *
- * @brief Fills RlcBearerCfg structure
+ * @brief Builds Rlc Mode Default Configuration
  *
  * @details
  *
- *    Function : fillRlcBearerCfg
+ *    Function : fillDefaultRlcModeCfg
  *
- *    Functionality: Fills Rlc Bearer Cfg
+ *    Functionality: Builds Rlc Mode Default Configuration
  *
  *
  *****************************************************************/
-void fillRlcBearerCfg(uint16_t cellId, uint8_t ueIdx, RlcUeCfg *ueCfg)
-{
-   uint8_t idx;
-   ueCfg->cellId       = cellId;
-   ueCfg->ueIdx        = ueIdx;
-   ueCfg->numLcs       = SRB1_LCID; 
 
-   for(idx = 0; idx < ueCfg->numLcs; idx++)
+uint8_t fillDefaultRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *lcCfg)
+{
+   if(lcCfg)
    {
-      ueCfg->rlcBearerCfg[idx].rbId         = RB_ID_SRB;
-      ueCfg->rlcBearerCfg[idx].rbType       = RB_TYPE_SRB;
-      ueCfg->rlcBearerCfg[idx].lcId         = SRB1_LCID;
-      ueCfg->rlcBearerCfg[idx].lcType       = LCH_DCCH;
-      ueCfg->rlcBearerCfg[idx].rlcMode      = RLC_AM;
-      switch(ueCfg->rlcBearerCfg[idx].rlcMode)
+      switch(rlcMode)
       {
-         case RLC_AM:
-           memset(&ueCfg->rlcBearerCfg[idx].u.amCfg, 0, sizeof(AmBearerCfg));
-            fillAmInfo(&ueCfg->rlcBearerCfg[idx].u.amCfg);
-            break;
-         case RLC_UM_BI_DIRECTIONAL:
-           memset(&ueCfg->rlcBearerCfg[idx].u.umBiDirCfg, 0, sizeof(UmBiDirBearerCfg));
-            fillUmBiDirInfo(&ueCfg->rlcBearerCfg[idx].u.umBiDirCfg);
-            break;
-         case RLC_UM_UNI_DIRECTIONAL_UL:
-           memset(&ueCfg->rlcBearerCfg[idx].u.umUniDirUlCfg, 0, sizeof(UmUniDirUlBearerCfg));
-            fillUmUniDirUlInfo(&ueCfg->rlcBearerCfg[idx].u.umUniDirUlCfg);
-            break;
-         case RLC_UM_UNI_DIRECTIONAL_DL:
-           memset(&ueCfg->rlcBearerCfg[idx].u.umUniDirDlCfg, 0, sizeof(UmUniDirDlBearerCfg));
-            fillUmUniDirDlInfo(&ueCfg->rlcBearerCfg[idx].u.umUniDirDlCfg);
-            break;
-         default :
-            DU_LOG("\nDU_APP: Rlc Mode invalid %d", ueCfg->rlcBearerCfg[idx].rlcMode);
-            break;
+         case RLC_AM :
+            {
+              if(!lcCfg->u.amCfg)
+              {
+                 DU_ALLOC_SHRABL_BUF(lcCfg->u.amCfg, sizeof(AmBearerCfg));
+                if(lcCfg->u.amCfg)
+                   fillDefaultAmInfo(lcCfg->u.amCfg);
+              }
+               break;
+            }
+         case RLC_UM_BI_DIRECTIONAL :
+            {
+              if(!lcCfg->u.umBiDirCfg)
+              {
+                 DU_ALLOC_SHRABL_BUF(lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
+                if(lcCfg->u.umBiDirCfg)
+                    fillDefaultUmBiInfo(lcCfg->u.umBiDirCfg);
+              }
+               break;
+            }
+         case RLC_UM_UNI_DIRECTIONAL_UL :
+            {
+              if(!lcCfg->u.umUniDirUlCfg)
+              {
+                  DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
+                 if(lcCfg->u.umUniDirUlCfg)
+                    fillDefaultUmUlInfo(lcCfg->u.umUniDirUlCfg);
+              }
+               break;
+            }
+         case RLC_UM_UNI_DIRECTIONAL_DL :
+            {
+              if(!lcCfg->u.umUniDirDlCfg)
+              {
+                  DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
+                  if(lcCfg->u.umUniDirDlCfg)
+                  fillDefaultUmDlInfo(lcCfg->u.umUniDirDlCfg);
+              }
+               break;
+            }
+         default:
+            DU_LOG("\nDUAPP: Invalid rlcMode %d at extractRlcCfgToAddMod()", rlcMode);
+            return RFAILED;
       }
+
+   }
+   else
+   {
+      DU_LOG("\nDUAPP: Received Lc Config is NULL");
+      return RFAILED;
    }
+   return ROK;
+}
+void fillRlcSrb1LcCfg(RlcBearerCfg *rlcLcCfg)
+{
+   rlcLcCfg->rbId   = SRB1_LCID;
+   rlcLcCfg->rbType = RB_TYPE_SRB;
+   rlcLcCfg->lcId   = SRB1_LCID;
+   rlcLcCfg->lcType = LCH_DCCH;
+   rlcLcCfg->rlcMode = RLC_AM;
+   rlcLcCfg->configType = CONFIG_ADD;
+   fillDefaultRlcModeCfg(rlcLcCfg->rlcMode, rlcLcCfg);
 }
 
-/******************************************************************
+/*******************************************************************
  *
- * @brief creates UE context
+ * @brief Processes UE ReConfig Req to RLC UL
  *
  * @details
  *
- *    Function : duCreateUeCb
- *
- *    Functionality: Creates UE Conetxt
- *
- * @params[in] UeCcchCtxt Pointer
- *             UeIdx Pointer
+ *    Function : sendUeReCfgReqToRlc
  *
- * @return ROK     - success
- *         RFAILED - failure
- * ****************************************************************/
-uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId)
-{
-   uint8_t cellIdx = 0;
-   uint8_t ret     = ROK;
+ *    Functionality: 
+ *     Processes UE Reconfig Req to RLC UL
+ * 
+ *  @params[in]     Pointer to RlcUeCfg
+ *  @return ROK     - success
+ *          RFAILED - failure
+ * 
+ *****************************************************************/
+
+uint8_t sendUeReCfgReqToRlc(RlcUeCfg *rlcUeCfg)
+{
+   uint8_t ret;
+   Pst pst;
+   
+   FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_RECONFIG_REQ);
+   if(rlcUeCfg)
+   {
+      /* Processing one Ue at a time to RLC */
+      DU_LOG("\nDU_APP: Sending Reconfig Request to RLC UL");
+      ret = (*packRlcUeReconfigReqOpts[pst.selector])(&pst, rlcUeCfg);
+      if(ret == RFAILED)
+      {
+         DU_LOG("\nDU_APP : Failed to send Ue Reconfig Req to RLC at sendUeReCfgReqToRlc()");
+         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCfg));
+      }
+   }
+   else
+   {
+      DU_LOG("\n DU_APP: Received RlcUeCfg is NULL at sendUeReCfgReqToRlc()");
+      ret = RFAILED;
+   }
+   return ret;
+}
+
+/******************************************************************
+ *
+ * @brief Fills RlcBearerCfg structure
+ *
+ * @details
+ *
+ *    Function : fillRlcUeCfg
+ *
+ *    Functionality: Fills Rlc Bearer Cfg
+ *
+ *
+ *****************************************************************/
+uint8_t fillRlcUeCfg(uint16_t cellId, uint8_t ueIdx,\
+   DuUeCfg *ueCfgDb, RlcUeCfg *rlcUeCfg)
+{
+   uint8_t ret, dbIdx, lcIdx, cellIdx;
+   bool lcIdFound = false;
+   RlcUeCfg *duRlcDb = NULLP;
+
+   ret = ROK;
+   if(!ueCfgDb)
+   {
+      /* Initial RB being Added */ 
+      rlcUeCfg->cellId       = cellId;
+      rlcUeCfg->ueIdx        = ueIdx;
+      fillRlcSrb1LcCfg(&rlcUeCfg->rlcLcCfg[0]);
+      rlcUeCfg->numLcs++;
+   }
+   else
+   {
+      /* Fetch RlcDb from DuUeCb */ 
+      GET_CELL_IDX(cellId, cellIdx);
+      duRlcDb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg;
+      /*Filling RlcUeCfg */
+      rlcUeCfg->cellId       = cellId;
+      rlcUeCfg->ueIdx        = ueIdx;
+      for(dbIdx = 0; dbIdx < ueCfgDb->numRlcLcs; dbIdx++)
+      {
+        fillDefaultRlcModeCfg(ueCfgDb->rlcLcCfg[dbIdx].rlcMode, &ueCfgDb->rlcLcCfg[dbIdx]);
+        /* Fill Rlc Ue Cfg List for ADD/MOD/DEL */
+        for(lcIdx = 0; lcIdx < duRlcDb->numLcs; lcIdx++)
+        { 
+           if(ueCfgDb->rlcLcCfg[dbIdx].lcId == duRlcDb->rlcLcCfg[lcIdx].lcId)
+           {
+              lcIdFound = true;
+              if((ueCfgDb->rlcLcCfg[dbIdx].configType == CONFIG_UNKNOWN)||
+                    (ueCfgDb->rlcLcCfg[dbIdx].configType == CONFIG_MOD))
+              {
+                 /* MOD */ 
+                 ueCfgDb->rlcLcCfg[dbIdx].configType = CONFIG_MOD; /* update Db for MOD type */
+                 memcpy(&rlcUeCfg->rlcLcCfg[dbIdx], &ueCfgDb->rlcLcCfg[dbIdx], sizeof(RlcBearerCfg));
+              }
+           }
+           else
+              lcIdFound = false;
+        }
+        if(!lcIdFound)
+        {
+           /* ADD/ DEL Config Type */
+           memcpy(&rlcUeCfg->rlcLcCfg[dbIdx], &ueCfgDb->rlcLcCfg[dbIdx], sizeof(RlcBearerCfg));
+        }
+        rlcUeCfg->numLcs++;
+      }
+   }
+   return ret;
+}
+
+/******************************************************************
+ *
+ * @brief creates UE context
+ *
+ * @details
+ *
+ *    Function : duCreateUeCb
+ *
+ *    Functionality: Creates UE Conetxt
+ *
+ * @params[in] UeCcchCtxt Pointer
+ *             UeIdx Pointer
+ *
+ * @return ROK     - success
+ *         RFAILED - failure
+ * ****************************************************************/
+uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId)
+{
+   uint8_t cellIdx = 0;
+   uint8_t ret     = ROK;
    uint8_t ueIdx;
 
    for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
@@ -1145,22 +1395,25 @@ uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId)
         GET_UE_IDX(ueCcchCtxt->crnti, ueIdx);
         DU_LOG("\nDU_APP: Filling UeCb for ueIdx [%d]", ueIdx);
 
+        duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].crnti = ueCcchCtxt->crnti;
         duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId = ueCcchCtxt->gnbDuUeF1apId;
         duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId = gnbCuUeF1apId;
+        duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].drbBitMap     = NULLP;
         duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].ueState       = UE_ACTIVE;
+        duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].f1UeDb        = NULLP;
 
         /* Filling Mac Ue Config */ 
         memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg, 0, sizeof(MacUeCfg));
          ret = duBuildAndSendUeCreateReqToMac(ueCcchCtxt->cellId, ueIdx, ueCcchCtxt->crnti,\
                 &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg);
-         if(ret)
+         if(ret == RFAILED)
             DU_LOG("\nDU_APP: Failed to send UE create request to MAC");
          
         /* Filling Rlc Ue Config */
          memset(&duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg, 0, sizeof(RlcUeCfg));
          ret = duBuildAndSendUeCreateReqToRlc(ueCcchCtxt->cellId, ueIdx, \
                 &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg);
-         if(ret)
+         if(ret == RFAILED)
             DU_LOG("\nDU_APP: Failed to send UE create request to RLC");
 
         duCb.actvCellLst[cellIdx]->numActvUes++;
@@ -1191,14 +1444,17 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueIdx,\
    uint16_t crnti, MacUeCfg *duMacUeCfg)
 {
    uint8_t ret = ROK;
-   MacUeCfg *macUeCfg = NULLP;
    Pst pst;
-   memset(&pst, 0, sizeof(Pst));
-
-   fillMacUeCfg(cellId, ueIdx, crnti, duMacUeCfg);
+   MacUeCfg *macUeCfg = NULLP;
 
+   ret = fillMacUeCfg(cellId, ueIdx, crnti, NULL, duMacUeCfg);
+   if(ret == RFAILED)
+   {
+      DU_LOG("\nDU APP: Failed to fill MacUeCfg at duBuildAndSendUeCreateReqToMac()");
+      return RFAILED;
+   }
    /* Fill Pst */
-   FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CREATE_REQ);
+   FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_CONFIG_REQ);
 
    /* Copying ueCb to a sharable buffer */
    DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
@@ -1210,11 +1466,10 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueIdx,\
 
       /* Processing one Ue at a time to MAC */
       ret = (*packMacUeCreateReqOpts[pst.selector])(&pst, macUeCfg);
-      if(ret)
+      if(ret == RFAILED)
       {
-        DU_LOG("\nDU_APP : Failure in sending Ue Create Req to MAC");
+        DU_LOG("\nDU_APP : Failure in sending Ue Create Req to MAC at duBuildAndSendUeCreateReqToMac()");
         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macUeCfg, sizeof(MacUeCfg));
-        ret = RFAILED;
       }
    }
    else
@@ -1227,30 +1482,337 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueIdx,\
 
 /*******************************************************************
  *
- * @brief Handle UE create response from MAC
+ * @brief To update DuUeCb Mac Cfg
+ *
+ * @details
+ *
+ *    Function : duUpdateMacCfg
+ *    Functionality:  update DuUeCb MAC Cfg
+ *
+ * @params[in] DuUeCb Pointer
+ *             UeContextSetupDb pointer 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t duUpdateMacCfg(MacUeCfg *macUeCfg, UeContextSetupDb *f1UeDb) 
+{
+   uint8_t ret, lcIdx, dbIdx, numLcs, lcDelIdx;
+   ret = ROK;
+
+   /*Filling Cell Group Cfg*/
+   ret =  procUeReCfgCellInfo(macUeCfg, f1UeDb->cellGrpCfg);
+   if(ret == ROK)
+   {
+      ret = getMaxAggrBitRate(macUeCfg->maxAggrBitRate, f1UeDb->duUeCfg.maxAggrBitRate);
+   }
+   /* Filling LC Context */
+   for(dbIdx = 0; (dbIdx < f1UeDb->duUeCfg.numMacLcs && ret == ROK); dbIdx++)
+   {
+      numLcs = macUeCfg->numLcs;
+      for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
+      {
+        if(f1UeDb->duUeCfg.macLcCfg[dbIdx].lcId ==  macUeCfg->lcCfgList[lcIdx].lcId)
+        {
+           if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_MOD)
+           {
+              ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[lcIdx],&f1UeDb->duUeCfg.macLcCfg[dbIdx]);
+           }
+           else if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_DEL)
+           {
+              /* Free memory at matched  lcIdx index */
+              freeMacLcCfg(&macUeCfg->lcCfgList[lcIdx]);
+              macUeCfg->numLcs--;
+              for(lcDelIdx = lcIdx; lcDelIdx < macUeCfg->numLcs; lcDelIdx++)
+              {
+                 /* moving all elements one index ahead */
+                 ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[lcDelIdx], &macUeCfg->lcCfgList[lcDelIdx+1]);
+                 freeMacLcCfg(&macUeCfg->lcCfgList[lcDelIdx+1]);
+                 if(ret == RFAILED)
+                 {
+                     DU_LOG("\nDU_APP: Failed to delete LC at Idx %d in duUpdateMacCfg()", lcDelIdx);
+                    break;
+                 }
+              }
+           }
+        }
+      } 
+      if(f1UeDb->duUeCfg.macLcCfg[dbIdx].configType == CONFIG_ADD)
+      {
+        ret = fillMacLcCfgToAddMod(&macUeCfg->lcCfgList[numLcs], &f1UeDb->duUeCfg.macLcCfg[dbIdx]);
+        if(ret == RFAILED)
+        {
+           DU_LOG("\nDU_APP: Failed to add LC at Idx %d in duUpdateMacCfg()", numLcs);
+           break;
+        }
+        macUeCfg->numLcs++;
+      }
+               
+   }
+   return ret;
+}
+
+/******************************************************************
+ *
+ * @brief Function to fill the RLC Lc cfg from ueSetupReqDb
+ *
+ * @details
+ *
+ *    Function : fillRlcCfgToAddMod
+ *
+ *    Functionality: Function to fill the RLC Lc cfg from ueSetupReqDb
+ *
+ *
+ *****************************************************************/
+
+uint8_t fillRlcCfgToAddMod(RlcBearerCfg *lcCfg, RlcBearerCfg *f1UeDbLcCfg)
+{
+   lcCfg->configType = f1UeDbLcCfg->configType;
+   lcCfg->rbId       = f1UeDbLcCfg->rbId;
+   lcCfg->rbType     = f1UeDbLcCfg->rbType;
+   lcCfg->lcId       = f1UeDbLcCfg->lcId;
+   lcCfg->lcType     = f1UeDbLcCfg->lcType;
+   lcCfg->rlcMode    = f1UeDbLcCfg->rlcMode;
+   switch(lcCfg->rlcMode)
+   {
+      case RLC_AM :
+      {
+         if(!lcCfg->u.amCfg)
+        {
+            DU_ALLOC_SHRABL_BUF(lcCfg->u.amCfg, sizeof(AmBearerCfg));
+            if(!lcCfg->u.amCfg)
+              return RFAILED;
+        }
+         /* DL AM */
+         lcCfg->u.amCfg->dlAmCfg.snLenDl     = f1UeDbLcCfg->u.amCfg->dlAmCfg.snLenDl;    
+         lcCfg->u.amCfg->dlAmCfg.pollRetxTmr = f1UeDbLcCfg->u.amCfg->dlAmCfg.pollRetxTmr;
+         lcCfg->u.amCfg->dlAmCfg.pollPdu     = f1UeDbLcCfg->u.amCfg->dlAmCfg.pollPdu;
+         lcCfg->u.amCfg->dlAmCfg.pollByte    = f1UeDbLcCfg->u.amCfg->dlAmCfg.pollByte;   
+         lcCfg->u.amCfg->dlAmCfg.maxRetxTh   = f1UeDbLcCfg->u.amCfg->dlAmCfg.maxRetxTh;   
+         /* UL AM */
+         lcCfg->u.amCfg->ulAmCfg.snLenUl     = f1UeDbLcCfg->u.amCfg->ulAmCfg.snLenUl;
+         lcCfg->u.amCfg->ulAmCfg.reAssemTmr  = f1UeDbLcCfg->u.amCfg->ulAmCfg.reAssemTmr; 
+         lcCfg->u.amCfg->ulAmCfg.statProhTmr = f1UeDbLcCfg->u.amCfg->ulAmCfg.statProhTmr;
+        break;
+      }
+      case RLC_UM_BI_DIRECTIONAL :
+      {
+         if(!lcCfg->u.umBiDirCfg)
+        {
+            DU_ALLOC_SHRABL_BUF(lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
+           if(!lcCfg->u.umBiDirCfg)
+               return RFAILED;
+         }
+         /* UL UM BI DIR INFO */
+         lcCfg->u.umBiDirCfg->ulUmCfg.snLenUlUm  = f1UeDbLcCfg->u.umBiDirCfg->ulUmCfg.snLenUlUm;  
+         lcCfg->u.umBiDirCfg->ulUmCfg.reAssemTmr = f1UeDbLcCfg->u.umBiDirCfg->ulUmCfg.reAssemTmr;
+         /* DL UM BI DIR INFO */
+         lcCfg->u.umBiDirCfg->dlUmCfg.snLenDlUm  = f1UeDbLcCfg->u.umBiDirCfg->dlUmCfg.snLenDlUm;
+         break;
+      }
+      case RLC_UM_UNI_DIRECTIONAL_UL :
+      {
+         if(!lcCfg->u.umUniDirUlCfg)
+        {
+            DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
+           if(!lcCfg->u.umUniDirUlCfg)
+              return RFAILED;
+        }
+         lcCfg->u.umUniDirUlCfg->ulUmCfg.snLenUlUm  = f1UeDbLcCfg->u.umUniDirUlCfg->ulUmCfg.snLenUlUm;  
+         lcCfg->u.umUniDirUlCfg->ulUmCfg.reAssemTmr = f1UeDbLcCfg->u.umUniDirUlCfg->ulUmCfg.reAssemTmr;
+         break;
+
+      }
+      case RLC_UM_UNI_DIRECTIONAL_DL :
+      {
+         if(!lcCfg->u.umUniDirDlCfg)
+        {
+            DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
+           if(!lcCfg->u.umUniDirDlCfg)
+              return RFAILED;
+         }
+         lcCfg->u.umUniDirDlCfg->dlUmCfg.snLenDlUm  = f1UeDbLcCfg->u.umUniDirDlCfg->dlUmCfg.snLenDlUm;
+         break;
+      }
+      default:
+         DU_LOG("\nDU_APP: Invalid Rlc Mode %d at fillRlcCfgToAddMod()", lcCfg->rlcMode);
+        return RFAILED;
+   }
+   return ROK;
+}
+
+/*******************************************************************
+ *
+ * @brief To update DuUeCb Rlc Lc Cfg
+ *
+ * @details
+ *
+ *    Function : duUpdateRlcLcCfg
+ *    Functionality:  update DuUeCb Rlc Lc Cfg
+ *
+ * @params[in] DuUeCb Pointer
+ *             UeContextSetupDb pointer 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t duUpdateRlcLcCfg(RlcUeCfg *rlcUeCfg, UeContextSetupDb *f1UeDb)
+{
+   uint8_t ret, lcIdx, dbIdx, numLcs, lcDelIdx;
+
+   ret = ROK;
+   for(dbIdx = 0; (dbIdx < f1UeDb->duUeCfg.numRlcLcs && ret ==ROK); dbIdx++)
+   {
+      numLcs = rlcUeCfg->numLcs;
+      for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
+      {
+        if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].lcId == rlcUeCfg->rlcLcCfg[lcIdx].lcId)
+        {
+           if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_MOD)
+           {
+              ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcIdx], &f1UeDb->duUeCfg.rlcLcCfg[dbIdx]);
+           }
+           else if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_DEL)
+           {
+              /* Free memory at matched lcIdx index */
+              freeRlcLcCfg(&rlcUeCfg->rlcLcCfg[lcIdx]);
+              rlcUeCfg->numLcs--;
+              for(lcDelIdx = lcIdx; lcDelIdx < rlcUeCfg->numLcs; lcDelIdx++)
+              {
+                 ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcDelIdx], &rlcUeCfg->rlcLcCfg[lcDelIdx+1]);
+                 freeRlcLcCfg(&rlcUeCfg->rlcLcCfg[lcDelIdx+1]);
+                 if(ret == RFAILED)
+                 {
+                     DU_LOG("\nDU_APP: Failed to delete LC at Idx %d in duUpdateRlcCfg()", lcDelIdx);
+                    break;
+                 }
+              }
+           }
+        }
+      }
+      if(f1UeDb->duUeCfg.rlcLcCfg[dbIdx].configType == CONFIG_ADD)
+      {
+        ret = fillRlcCfgToAddMod(&rlcUeCfg->rlcLcCfg[lcIdx], &f1UeDb->duUeCfg.rlcLcCfg[dbIdx]);
+        if(ret == ROK)
+           rlcUeCfg->numLcs++;
+      }
+   }
+   return ret;
+}
+
+
+/*******************************************************************
+ *
+ * @brief @brief To update DuUeCb Mac and Rlc Ue Cfg
+ * 
+ *
+ * @details
+ *
+ *    Function : duUpdateDuUeCbCfg
+ *
+ *    Functionality: update DuUeCb Mac and Rlc Ue Cfg
+ *
+ * @params[in] ueIdx, cellIdx 
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t duUpdateDuUeCbCfg(uint8_t ueIdx, uint8_t cellId)
+{
+   uint8_t ret = ROK, cellIdx = 0, crnti=0;
+   DuUeCb *ueCb = NULLP;
+
+   GET_CELL_IDX(cellId, cellIdx);
+   
+   if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg. \
+         macUeCfgState == UE_RECFG_COMPLETE) &&
+      (duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg. \
+         rlcUeCfgState == UE_RECFG_COMPLETE))
+   {
+      ueCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1];
+
+      /*Filling RLC Ue Cfg */
+      ueCb->rlcUeCfg.cellId = cellId;
+      ueCb->rlcUeCfg.ueIdx  = ueIdx;
+      ret = duUpdateRlcLcCfg(&ueCb->rlcUeCfg, ueCb->f1UeDb);
+      if(ret == ROK)
+      {
+         /*Filling MAC Ue Cfg */
+         GET_CRNTI(crnti, ueIdx);
+         ueCb->macUeCfg.cellId = cellId;
+         ueCb->macUeCfg.ueIdx  = ueIdx;
+         ueCb->macUeCfg.crnti  = crnti;
+         ret = duUpdateMacCfg(&ueCb->macUeCfg, ueCb->f1UeDb);
+         if(ret == RFAILED)
+            DU_LOG("\nDU APP: Failed while updating MAC LC Config at duUpdateDuUeCbCfg()");
+      }
+      else
+         DU_LOG("\nDU APP: Failed while updating RLC LC Config at duUpdateDuUeCbCfg()");
+   }
+   else
+      ret = RFAILED;
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Handle UE config response from MAC
  *
  * @details
  *
- *    Function : DuHandleMacUeCreateRsp
+ *    Function : DuProcMacUeCfgRsp
  *
- *    Functionality: Handle UE create response from MAC
+ *    Functionality: Handle UE Config response from MAC
  *
  * @params[in] Pointer to MacUeCfgRsp and Pst 
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t DuHandleMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
+uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
 {
-   if(cfgRsp->result == MAC_DU_APP_RSP_OK)
+   uint8_t ret = ROK;
+   uint8_t ueIdx, cellIdx;
+
+   if(cfgRsp)
    {
-      DU_LOG("\nDU APP : MAC UE Create Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx);
+      if(cfgRsp->result == MAC_DU_APP_RSP_OK)
+      {
+         cellIdx = (cfgRsp->cellId -1);
+         ueIdx = (cfgRsp->ueIdx -1);
+
+         if(pst->event == EVENT_MAC_UE_CONFIG_RSP)
+        {
+            DU_LOG("\nDU APP : MAC UE Create Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx);
+            duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.macUeCfgState = UE_CONFIG_COMPLETE;
+        }
+         else if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
+         {
+            DU_LOG("\nDU APP : MAC UE Reconfig Response : SUCCESS [UE IDX : %d]", cfgRsp->ueIdx);
+            duCb.actvCellLst[cellIdx]->ueCb[ueIdx].macUeCfg.macUeCfgState = UE_RECFG_COMPLETE;
+            if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK)
+               BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId);
+         }
+      }
+      else
+      {
+         DU_LOG("\nDU APP : MAC UE CFG Response for EVENT[%d]: FAILURE [UE IDX : %d]", pst->event, cfgRsp->ueIdx);
+        if(pst->event == EVENT_MAC_UE_RECONFIG_RSP)
+        {
+           //TODO: Send the failure case in Ue Context Setup Response
+        }
+         ret = RFAILED;
+      }
    }
    else
    {
-      DU_LOG("\nDU APP : MAC UE Create Response : FAILURE [UE IDX : %d]", cfgRsp->ueIdx);
+      DU_LOG("\nDU APP : Received MAC Ue Config Response is NULL at DuProcMacUeCfgRsp()");
+      ret = RFAILED;
    }
-   return ROK;
+   return ret;
 }
 
 /*******************************************************************
@@ -1272,15 +1834,15 @@ uint8_t DuHandleMacUeCreateRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
  * 
  *****************************************************************/
 
-uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t ueIdx, RlcUeCfg *duRlcUeCfg)
+uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t ueIdx,\
+   RlcUeCfg *duRlcUeCfg)
 {
    uint8_t ret = ROK;
    RlcUeCfg *rlcUeCfg = NULLP;
    Pst pst;
-   memset(&pst, 0, sizeof(Pst));
   
-   fillRlcBearerCfg(cellId, ueIdx, duRlcUeCfg);
-   FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UL_UE_CREATE_REQ);
+   fillRlcUeCfg(cellId, ueIdx, NULL, duRlcUeCfg);
+   FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_CONFIG_REQ);
 
    /* Copying ueCfg to a sharable buffer */
    DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCfg));
@@ -1290,8 +1852,8 @@ uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t ueIdx, RlcUeCfg
       memcpy(rlcUeCfg, duRlcUeCfg, sizeof(RlcUeCfg));
       /* Processing one Ue at a time to RLC */
       DU_LOG("\nDU_APP: Sending UE create request to RLC UL");
-      ret = (*packRlcUlUeCreateReqOpts[pst.selector])(&pst, rlcUeCfg);
-      if(ret)
+      ret = (*packRlcUeCreateReqOpts[pst.selector])(&pst, rlcUeCfg);
+      if(ret == RFAILED)
       {
          DU_LOG("\nDU_APP : Failure in sending Ue Create Req to RLC");
          DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, rlcUeCfg, sizeof(RlcUeCfg));
@@ -1306,15 +1868,14 @@ uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t ueIdx, RlcUeCfg
    return ret;
 }
 
-
-
 /*******************************************************************
  *
  * @brief Processes UE create Rsp received from RLC UL
  *
  * @details
  *
- *    Function : DuProcRlcUlUeCfgRsp
+ *    Function : DuProcRlcUeCfgRsp
  *
  *    Functionality: 
  *     Processes UE create Rsp received from RLC UL
@@ -1325,33 +1886,196 @@ uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t ueIdx, RlcUeCfg
  *          RFAILED - failure
  * 
  *****************************************************************/
-
-uint8_t DuProcRlcUlUeCreateRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
+uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
 {
    uint8_t ret = ROK;
+   uint8_t ueIdx, cellIdx;
 
    if(cfgRsp)
    {
       if(cfgRsp->result == RLC_DU_APP_RSP_OK)
       {
-         DU_LOG("\nDU_APP: RLC UE Create Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx);
+         cellIdx = (cfgRsp->cellId -1);
+         ueIdx   = (cfgRsp->ueIdx -1);
+
+         if(pst->event == EVENT_RLC_UE_CONFIG_RSP)
+        {
+           DU_LOG("\nDU_APP: RLC UE Create Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx);
+           duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcUeCfgState = UE_CONFIG_COMPLETE;
+        }
+        else if(pst->event == EVENT_RLC_UE_RECONFIG_RSP)
+        {
+            DU_LOG("\nDU_APP: RLC UE Reconfig Response : SUCCESS [UE IDX:%d]", cfgRsp->ueIdx);
+           duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE;
+           if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK)
+               BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId);
+             
+        }
       }
       else
       {
-         DU_LOG("\nDU_APP: RLC UE Create Response : FAILED [UE IDX:%d, REASON :%d]",\
-           cfgRsp->ueIdx, cfgRsp->reason);
+         DU_LOG("\nDU_APP: RLC UE CFG Response for EVENT[%d] : FAILED [UE IDX : %d, REASON :%d]",\
+           pst->event, cfgRsp->ueIdx, cfgRsp->reason);
+        if((pst->event == EVENT_RLC_UE_RECONFIG_RSP))
+        {
+            //TODO: update failure case in ue Context setup Response
+        }
         ret = RFAILED;
       }
       DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cfgRsp, sizeof(RlcUeCfgRsp));
    }
    else
    {
-      DU_LOG("\nDU_APP: Received RLC Ue Create Response is NULL");
+      DU_LOG("\nDU_APP: Received RLC Ue Config Response is NULL at DuProcRlcUeCfgRsp()");
       ret = RFAILED;
    }
    return ret;
 }
 
+/*******************************************************************
+ *
+ * @brief Builds and Send Ue Reconfig Req to RLC
+ *
+ * @details
+ *
+ *    Function : duBuildAndSendUeReCfgReqToRLC
+ *
+ *    Functionality: Builds and Send Ue Reconfig Req to RLC
+ *
+ * @params[in] cellId, crnti
+ *             DuUeCfg *ueCfgDb
+ *             RlcUeCfg *rlcUeCfg
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t duBuildAndSendUeReCfgReqToRlc(uint8_t cellId, uint8_t crnti, DuUeCfg *ueCfgDb)
+{
+   uint8_t ret = ROK, ueIdx = 0;
+   RlcUeCfg *rlcUeCfg = NULLP;
+
+   GET_UE_IDX(crnti, ueIdx);
+   DU_ALLOC_SHRABL_BUF(rlcUeCfg, sizeof(RlcUeCfg));
+   if(rlcUeCfg)
+   {
+      memset(rlcUeCfg, 0, sizeof(RlcUeCfg));
+      ret = fillRlcUeCfg(cellId, ueIdx, ueCfgDb, rlcUeCfg);
+      if(ret == RFAILED)
+         DU_LOG("\nDU APP: Failed at duBuildAndSendUeReCfgReqToRlc()");
+      else
+         ret = sendUeReCfgReqToRlc(rlcUeCfg);
+   }
+   else
+   {
+      DU_LOG("\nDU APP: Memory Alloc failed at duBuildAndSendUeReCfgReqToRlc()");
+      ret = RFAILED;
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Builds and Send Ue Reconfig Req to MAC
+ *
+ * @details
+ *
+ *    Function : duBuildAndSendUeReCfgReqToMac
+ *
+ *    Functionality: Builds and Send Ue Reconfig Req to MAC
+ *
+ * @params[in] CellGroupConfigRrc_t *macCellGrpCfg
+ *             DuUeCfg *ueCfgDb
+ *             MacUeCfg    *macUeCfg
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t duBuildAndSendUeReCfgReqToMac(uint8_t cellId, uint8_t crnti, UeContextSetupDb *ueCfgDb)
+{
+   uint8_t ret, ueIdx = 0;
+   MacUeCfg *macUeCfg = NULLP;
+
+   ret = ROK;
+   GET_UE_IDX(crnti, ueIdx);
+
+   DU_ALLOC_SHRABL_BUF(macUeCfg, sizeof(MacUeCfg));
+   if(macUeCfg)
+   {
+      memset(macUeCfg, 0, sizeof(MacUeCfg));
+      ret = fillMacUeCfg(cellId, ueIdx, crnti, ueCfgDb, macUeCfg);
+      if(ret == ROK)
+         ret = sendUeReCfgReqToMac(macUeCfg);
+   }
+   else
+   {
+      DU_LOG("\nDU_APP: Memory alloc failed for macUeCfg at duBuildAndSendUeReCfgReqToMac()");
+      ret = RFAILED;
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Process UE context setup request from CU
+ *
+ * @details
+ *
+ *    Function : duProcUeContextSetupRequest
+ *
+ *    Functionality: Process UE context setup request from CU
+ *
+ * @params[in] F1AP message
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t duProcUeContextSetupRequest(DuUeCb *ueCb)
+{
+   uint8_t ret, cellId;
+   
+   ret = ROK;
+   if(ueCb)
+   {
+      cellId = duCb.actvCellLst[ueCb->f1UeDb->cellIdx]->cellId;
+
+      if(ueCb->f1UeDb->rrcMsg)
+      {
+         /* Sending DL RRC Message to RLC */
+         ret = duBuildAndSendDlRrcMsgToRlc(cellId, ueCb->rlcUeCfg, SRB1_LCID, false, \
+            ueCb->f1UeDb->deliveryStaReq,  ueCb->f1UeDb->rrcMsgLen, ueCb->f1UeDb->rrcMsg);
+         if(ret == RFAILED)
+         {
+            DU_LOG("\nDU APP : Failed to send DL RRC msg in duProcUeContextSetupRequest()");
+            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, ueCb->f1UeDb->rrcMsg, ueCb->f1UeDb->rrcMsgLen);
+         }
+      }
+
+      if(ret == ROK)
+      {
+         DU_LOG("\nDU_APP: Processing Ue Context Setup Request for cellId [%d]", cellId);
+         /* Filling RLC Ue Reconfig */ 
+         ret = duBuildAndSendUeReCfgReqToRlc(cellId, ueCb->crnti, &ueCb->f1UeDb->duUeCfg);
+         if(ret == RFAILED)
+            DU_LOG("\nDU_APP: Failed to build ctxt setup req for RLC at duBuildAndSendUeReCfgReqToRlc()");
+         
+        /* Filling MAC Ue Reconfig */
+         ret = duBuildAndSendUeReCfgReqToMac(cellId, ueCb->crnti, ueCb->f1UeDb);
+         if(ret == RFAILED)
+            DU_LOG("\nDU_APP: Failed at build ctxt setup req for MAC at duBuildAndSendUeReCfgReqToMac()");
+      }
+      
+   }
+   else
+   {
+      //TODO: To send the failure cause in UeContextSetupRsp
+      DU_LOG("DU_APP: Failed to process UE CNTXT SETUP REQ at duProcUeContextSetupRequest()");
+   }
+   return ret;
+}
+
 /**********************************************************************
   End of file
  ***********************************************************************/