<JIRA ID: ODUHIGH-396 : scaling of DRBs to MAX>
[o-du/l2.git] / src / du_app / du_f1ap_msg_hdl.c
index bb82b16..7e4d52b 100644 (file)
 #include "GTPTunnel.h"
 
 #ifdef O1_ENABLE
-#include "ConfigInterface.h"
+#include "CmInterface.h"
 extern StartupConfig g_cfg;
 #endif
 
 DuCfgParams duCfgParam;
 
+/******************************************************************
+ *
+ * @brief Function to fetch lcId based on DRB Id
+ *
+ * @details
+ *
+ *    Function : fetchLcId
+ *
+ *    @params[in] drbId
+ *
+ *    Functionality: Function to fetch lcId based on DRB Id
+ *
+ * Returns: lcId - SUCCESS
+ *          RFAILED - FAILURE
+ *****************************************************************/
+
+uint8_t fetchLcId(uint8_t drbId)
+{
+   uint8_t cellIdx = 0, ueIdx = 0, lcIdx = 0, numLcs = 0, lcId = 0;
+
+   for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
+   {
+      for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+      {
+         if(duCb.actvCellLst[cellIdx] != NULLP)
+         {
+            numLcs = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.numLcs;
+            for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
+            {
+               if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].rbId == drbId && \
+                  duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].rbType == RB_TYPE_DRB)
+               {
+                  lcId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].lcId;
+                  return lcId;
+               }
+            }
+         }
+      }
+   }
+   DU_LOG("\nERROR   -->  DU_APP: fetchLcId() failed for drbId %d", drbId);
+   return RFAILED;
+}
+
 /************************************************************************
  *
  * @brief Converts enum values into actual value of Poll retransmit timer
@@ -804,7 +847,7 @@ uint8_t BuildDLNRInfo(NRFreqInfo_t *dlnrfreq)
 S16 BuildNrCellId(BIT_STRING_t *nrcell)
 {
    memset(nrcell->buf, 0, nrcell->size);
-   nrcell->buf[4]   = 16
+   nrcell->buf[4]   = duCfgParam.sib1Params.cellIdentity
    nrcell->bits_unused = 4;
    return ROK;
 }
@@ -986,7 +1029,7 @@ uint8_t BuildExtensions(ProtocolExtensionContainer_4624P3_t **ieExtend)
       }
    }
    
-   elementCnt = NUM_OF_SUPPORTED_SLICE;
+   elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices;
    idx = 0;
    (*ieExtend)->list.array[idx]->id = ProtocolIE_ID_id_TAISliceSupportList;
    (*ieExtend)->list.array[idx]->criticality = Criticality_ignore;
@@ -1482,7 +1525,8 @@ void FreeServedCellList( GNB_DU_Served_Cells_List_t *duServedCell)
                               }
                            }
                            DU_FREE(servedPlmnItem->iE_Extensions->list.array[0]->extensionValue.choice.\
-                           SliceSupportList.list.array, sizeof(SliceSupportItem_t*));
+                           SliceSupportList.list.array, servedPlmnItem->iE_Extensions->list.array[0]->\
+                           extensionValue.choice.SliceSupportList.list.size);
                         }
                         DU_FREE(servedPlmnItem->iE_Extensions->list.array[0],\
                         sizeof(ServedPLMNs_ItemExtIEs_t));
@@ -2076,7 +2120,7 @@ uint8_t fillServedPlmns(ServedPLMNs_List_t *servedPlmn)
    }
    
    ieIdx = 0;
-   elementCnt = NUM_OF_SUPPORTED_SLICE
+   elementCnt = duCfgParam.srvdCellLst[0].duCellInfo.cellInfo.srvdPlmn[0].taiSliceSuppLst.numSupportedSlices
    servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->id =ProtocolIE_ID_id_TAISliceSupportList;
    servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->criticality = Criticality_ignore;
    servedPlmn->list.array[arrayIdx]->iE_Extensions->list.array[ieIdx]->extensionValue.present = \
@@ -2283,7 +2327,7 @@ uint8_t fillServedCellInfo(Served_Cell_Information_t *srvCellInfo)
    {
       srvCellInfo->nRCGI.nRCellIdentity.buf[tmp] = 0;
    }
-   srvCellInfo->nRCGI.nRCellIdentity.buf[4] = 16;
+   srvCellInfo->nRCGI.nRCellIdentity.buf[4] = duCfgParam.sib1Params.cellIdentity;
    srvCellInfo->nRCGI.nRCellIdentity.bits_unused =4;
 
    /*nRPCI*/
@@ -2381,7 +2425,7 @@ uint8_t fillServCellToModItem(Served_Cells_To_Modify_Item_t *modifyItem)
    {
       modifyItem->oldNRCGI.nRCellIdentity.buf[ieIdx] = 0;
    }
-   modifyItem->oldNRCGI.nRCellIdentity.buf[4] = 16;
+   modifyItem->oldNRCGI.nRCellIdentity.buf[4] = duCfgParam.sib1Params.cellIdentity;
    modifyItem->oldNRCGI.nRCellIdentity.bits_unused = 4;
 
    if(fillServedCellInfo(&modifyItem->served_Cell_Information))
@@ -2490,7 +2534,7 @@ uint8_t fillCellToDeleteItem(struct Served_Cells_To_Delete_ItemIEs *deleteItemIe
    {
       deleteItem->oldNRCGI.nRCellIdentity.buf[arrIdx] = 0;
    }
-   deleteItem->oldNRCGI.nRCellIdentity.buf[4] = 16;
+   deleteItem->oldNRCGI.nRCellIdentity.buf[4] = duCfgParam.sib1Params.cellIdentity;
    deleteItem->oldNRCGI.nRCellIdentity.bits_unused = 4;
    return ROK;
 } 
@@ -3411,7 +3455,7 @@ uint8_t BuildRlcBearerToAddModList(struct CellGroupConfigRrc__rlc_BearerToAddMod
    coreset1StartPrb = coreset0EndPrb + 6;
    coreset1NumPrb = CORESET1_NUM_PRB;
    /* calculate the PRBs */
-   freqDomRscAllocType0(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
+   fillCoresetFeqDomAllocMap(((coreset1StartPrb)/6), (coreset1NumPrb/6), freqDomainResource);
    memcpy(controlRSet->frequencyDomainResources.buf, freqDomainResource, FREQ_DOM_RSRC_SIZE);
    controlRSet->frequencyDomainResources.bits_unused = bitsUnused;
 
@@ -4311,7 +4355,124 @@ uint8_t BuildBWPUlDedPuschCfg(PUSCH_Config_t *puschCfg)
 uint8_t BuildBWPUlDedPucchCfg(PUCCH_Config_t *pucchCfg)
 {
    uint8_t arrIdx, elementCnt;
+   uint8_t rsrcIdx, rsrcSetIdx;
+   PUCCH_ResourceSet_t *rsrcSet = NULLP;
+   PUCCH_Resource_t *rsrc = NULLP;
+
+   //RESOURCE SET
+   elementCnt = 1;
+   DU_ALLOC(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
+   if(pucchCfg->resourceSetToAddModList == NULL)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+      return RFAILED;
+   }
+
+   pucchCfg->resourceSetToAddModList->list.count = elementCnt;
+   pucchCfg->resourceSetToAddModList->list.size = elementCnt * sizeof(PUCCH_ResourceSet_t *);
+   DU_ALLOC(pucchCfg->resourceSetToAddModList->list.array, pucchCfg->resourceSetToAddModList->list.size);
+   if(pucchCfg->resourceSetToAddModList->list.array == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+      return RFAILED;
+   }
+   for(rsrcSetIdx=0; rsrcSetIdx < pucchCfg->resourceSetToAddModList->list.count; rsrcSetIdx++)
+   {
+      DU_ALLOC(pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t));
+      if(pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx] == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
+   }
+   rsrcSetIdx = 0;
+   rsrcSet = pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx];
+   rsrcSet->pucch_ResourceSetId = 1;
+   elementCnt = 1;
+   rsrcSet->resourceList.list.count = elementCnt;
+   rsrcSet->resourceList.list.size = elementCnt * sizeof(PUCCH_ResourceId_t *);
+   DU_ALLOC(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size);
+   if(rsrcSet->resourceList.list.array == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+      return RFAILED;
+   }
+   for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
+   {
+      DU_ALLOC(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
+      if(rsrcSet->resourceList.list.array[rsrcIdx] == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
+   }
+   rsrcIdx = 0;
+   *(rsrcSet->resourceList.list.array[rsrcIdx]) = 1;
 
+   //RESOURCE
+   elementCnt = 1;
+   DU_ALLOC(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
+   if(pucchCfg->resourceToAddModList == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+      return RFAILED;
+   }
+   pucchCfg->resourceToAddModList->list.count = elementCnt;
+   pucchCfg->resourceToAddModList->list.size = elementCnt * sizeof(PUCCH_Resource_t *);
+   DU_ALLOC(pucchCfg->resourceToAddModList->list.array, pucchCfg->resourceToAddModList->list.size);
+   if(pucchCfg->resourceToAddModList->list.array == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+      return RFAILED;
+   }
+   for(rsrcIdx=0; rsrcIdx < pucchCfg->resourceToAddModList->list.count; rsrcIdx++)
+   {
+      DU_ALLOC(pucchCfg->resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t));
+      if(pucchCfg->resourceToAddModList->list.array[rsrcIdx] == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+         return RFAILED;
+      }
+   }
+   rsrcIdx = 0;
+   rsrc = pucchCfg->resourceToAddModList->list.array[rsrcIdx];
+   rsrc->pucch_ResourceId = 1;
+   rsrc->startingPRB = 0;
+   rsrc->format.present = PUCCH_Resource__format_PR_format1; 
+   DU_ALLOC(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
+   if(rsrc->format.choice.format1 == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+      return RFAILED;
+   }
+   rsrc->format.choice.format1->initialCyclicShift = 0;
+   rsrc->format.choice.format1->nrofSymbols = 4;
+   rsrc->format.choice.format1->startingSymbolIndex = 0;
+   rsrc->format.choice.format1->timeDomainOCC = 0;
+
+   //PUCCH Format 1
+   DU_ALLOC(pucchCfg->format1, sizeof(struct PUCCH_Config__format1));
+   if(pucchCfg->format1 == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+      return RFAILED;
+   }
+   pucchCfg->format1->present = PUCCH_Config__format1_PR_setup;
+   DU_ALLOC(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t));
+   if(pucchCfg->format1->choice.setup == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+      return RFAILED;
+   }
+   DU_ALLOC(pucchCfg->format1->choice.setup->nrofSlots, sizeof(long));
+   if(pucchCfg->format1->choice.setup->nrofSlots == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildBWPUlDedPucchCfg");
+      return RFAILED;
+   }
+   *(pucchCfg->format1->choice.setup->nrofSlots) = PUCCH_FormatConfig__nrofSlots_n4;
+
+   //DL DATA TO UL ACK
    DU_ALLOC(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
    if(pucchCfg->dl_DataToUL_ACK == NULLP)
    {
@@ -5313,6 +5474,105 @@ void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg)
    }
 
 }
+
+/*******************************************************************
+ *
+ * @brief Frees memory allocated for Dedicated PUCCH config
+ *
+ * @details
+ *
+ *    Function : FreeBWPUlDedPucchCfg
+ *
+ *    Functionality: Deallocating memory of Dedicated PUCCH cfg
+ *
+ * @params[in] BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg
+ *
+ * @return void
+ *
+ * ****************************************************************/
+void FreeBWPUlDedPucchCfg(struct BWP_UplinkDedicated__pucch_Config *ulBwpPucchCfg)
+{
+   uint8_t k1Idx, rsrcIdx, rsrcSetIdx;
+   PUCCH_Config_t *pucchCfg = NULLP;
+   PUCCH_ResourceSet_t *rsrcSet = NULLP;
+   PUCCH_Resource_t *rsrc = NULLP;
+
+   if(ulBwpPucchCfg)
+   {
+      if(ulBwpPucchCfg->choice.setup)
+      {
+         pucchCfg = ulBwpPucchCfg->choice.setup;
+
+         //Free resource set list
+         if(pucchCfg->resourceSetToAddModList)
+         {
+            if(pucchCfg->resourceSetToAddModList->list.array)
+            {
+               for(rsrcSetIdx=0; rsrcSetIdx < pucchCfg->resourceSetToAddModList->list.count; rsrcSetIdx++)
+               {
+                  rsrcSet = pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx];
+                  if(rsrcSet->resourceList.list.array)
+                  {
+                     for(rsrcIdx=0; rsrcIdx < rsrcSet->resourceList.list.count; rsrcIdx++)
+                     {
+                        DU_FREE(rsrcSet->resourceList.list.array[rsrcIdx], sizeof(PUCCH_ResourceId_t));
+                     }
+                     DU_FREE(rsrcSet->resourceList.list.array, rsrcSet->resourceList.list.size);
+                  }
+                  DU_FREE(pucchCfg->resourceSetToAddModList->list.array[rsrcSetIdx], sizeof(PUCCH_ResourceSet_t));
+               }
+               DU_FREE(pucchCfg->resourceSetToAddModList->list.array, pucchCfg->resourceSetToAddModList->list.size);
+            }
+            DU_FREE(pucchCfg->resourceSetToAddModList, sizeof(struct PUCCH_Config__resourceSetToAddModList));
+         }
+
+         //Free resource list
+         if(pucchCfg->resourceToAddModList)
+         {
+            if(pucchCfg->resourceToAddModList->list.array)
+            {
+               for(rsrcIdx=0; rsrcIdx < pucchCfg->resourceToAddModList->list.count; rsrcIdx++)
+               {
+                  rsrc = pucchCfg->resourceToAddModList->list.array[rsrcIdx];
+                  DU_FREE(rsrc->format.choice.format1, sizeof(PUCCH_format1_t));
+                  DU_FREE(pucchCfg->resourceToAddModList->list.array[rsrcIdx], sizeof(PUCCH_Resource_t));
+               }
+               DU_FREE(pucchCfg->resourceToAddModList->list.array, pucchCfg->resourceToAddModList->list.size);
+            }
+            DU_FREE(pucchCfg->resourceToAddModList, sizeof(struct PUCCH_Config__resourceToAddModList));
+         }
+
+         //PUCCH Format 1
+         if(pucchCfg->format1)
+         {
+            if(pucchCfg->format1->choice.setup)
+            {
+               DU_FREE(pucchCfg->format1->choice.setup->nrofSlots, sizeof(long));
+               DU_FREE(pucchCfg->format1->choice.setup, sizeof(PUCCH_FormatConfig_t));
+            }
+            DU_FREE(pucchCfg->format1, sizeof(struct PUCCH_Config__format1));
+         }
+         
+         //DL DATA TO UL ACK
+         if(pucchCfg->dl_DataToUL_ACK)
+         {
+            if(pucchCfg->dl_DataToUL_ACK->list.array)
+            {
+               for(k1Idx = 0; k1Idx <  pucchCfg->dl_DataToUL_ACK->list.count; k1Idx++)
+               {
+                  DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array[k1Idx], sizeof(long));
+               }
+               DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size);
+            }
+            DU_FREE(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
+         }
+
+         DU_FREE(ulBwpPucchCfg->choice.setup, sizeof(PUCCH_Config_t));
+      }
+      DU_FREE(ulBwpPucchCfg, sizeof(struct BWP_UplinkDedicated__pucch_Config));
+   }
+}
+
 /*******************************************************************
  *
  * @brief Frees memory allocated for InitialUlBWP
@@ -5330,36 +5590,15 @@ void FreePuschTimeDomAllocList(PUSCH_Config_t *puschCfg)
  * ****************************************************************/
 void FreeInitialUlBWP(BWP_UplinkDedicated_t *ulBwp)
 {
-   uint8_t  rSetIdx, rsrcIdx, k1Idx;
+   uint8_t  rSetIdx, rsrcIdx;
    SRS_Config_t   *srsCfg = NULLP;
    PUSCH_Config_t *puschCfg = NULLP;
-   PUCCH_Config_t *pucchCfg = 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->pucch_Config)
-   {
-      if(ulBwp->pucch_Config->choice.setup)
-      {
-          pucchCfg = ulBwp->pucch_Config->choice.setup;
-          if(pucchCfg->dl_DataToUL_ACK)
-          {
-             if(pucchCfg->dl_DataToUL_ACK->list.array)
-             {
-                for(k1Idx = 0; k1Idx < pucchCfg->dl_DataToUL_ACK->list.count; k1Idx++)
-                {
-                   DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array[k1Idx], sizeof(long));
-                }
-                DU_FREE(pucchCfg->dl_DataToUL_ACK->list.array, pucchCfg->dl_DataToUL_ACK->list.size);
-             }
-             DU_FREE(pucchCfg->dl_DataToUL_ACK, sizeof(struct PUCCH_Config__dl_DataToUL_ACK));
-          }
-          DU_FREE(ulBwp->pucch_Config->choice.setup, sizeof(PUCCH_Config_t));
-      }
-      DU_FREE(ulBwp->pucch_Config, sizeof(struct BWP_UplinkDedicated__pucch_Config));
-   }
+   FreeBWPUlDedPucchCfg(ulBwp->pucch_Config);
 
    if(ulBwp->pusch_Config)
    {
@@ -6329,6 +6568,7 @@ void freeRlcLcCfg(RlcBearerCfg *lcCfg)
          DU_LOG("\nERROR  -->  DU_APP: Invalid Rlc Mode %d at freeRlcLcCfg()", lcCfg->rlcMode);
          break;
    }
+   DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, lcCfg->snssai, sizeof(Snssai));
 }
 
 /*******************************************************************
@@ -7372,6 +7612,48 @@ void extractUlLcCfg(UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg)
    }
 }
 
+/*******************************************************************
+*
+* @brief Function to extract Snssai Cfg Info from CU
+*
+* @details
+*
+*    Function : extractDrbSnssaiCfg
+*
+*    Functionality: Function to extract Drb Snssai Cfg Info from CU
+*
+* @params[in] DRB_Information_t *drbInfo, Snssai  *snssai
+* @return ROK/RFAILED
+*
+* ****************************************************************/
+
+uint8_t extractDrbSnssaiCfg(SNSSAI_t *RecvSnssai, Snssai **snssaiToBeShared)
+{
+   if(!(*snssaiToBeShared))
+   {
+      DU_ALLOC_SHRABL_BUF((*snssaiToBeShared), sizeof(Snssai));
+      if(snssaiToBeShared == NULLP)
+      {
+         DU_LOG("\nERROR  -->  DUAPP : extractDrbSnssaiCfg(): Memory failed at allocating for SNSSAI ");
+         return RFAILED;
+      }
+   }
+   if(RecvSnssai)
+   {
+      memcpy(&(*snssaiToBeShared)->sst, RecvSnssai->sST.buf, RecvSnssai->sST.size);
+      if(RecvSnssai->sD)
+      {
+         memcpy((*snssaiToBeShared)->sd, RecvSnssai->sD->buf,  RecvSnssai->sD->size);
+      }
+      else
+      {
+         DU_LOG("\nERROR  -->  DUAPP : extractDrbSnssaiCfg(): Received Null pointer of Snssai->SD");
+         return RFAILED;
+      }
+   }
+   return ROK;
+}
+
 /*******************************************************************
  *
  * @brief Function to procRlcLcCfg
@@ -7389,8 +7671,9 @@ void extractUlLcCfg(UlLcCfg *f1UlLcCfg, LogicalChannelConfig_t *ulLcCfg)
  * ****************************************************************/
 
 void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\
-   uint8_t configType, RLC_Config_t *f1RlcCfg, RlcBearerCfg *lcCfg)
+   uint8_t configType, RLC_Config_t *f1RlcCfg, RlcBearerCfg *lcCfg, QoSInformation_t *qoSInformation)
 {
+   DRB_Information_t *drbInfo;
 
    lcCfg->rbId   = rbId;
    lcCfg->configType = configType;
@@ -7413,10 +7696,24 @@ void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\
    {
       extractRlcModeCfg(lcCfg->rlcMode, lcCfg, f1RlcCfg);
    }
+   if(qoSInformation != NULLP)
+   {
+      if(qoSInformation->present == QoSInformation_PR_choice_extension)
+      {
+         if(qoSInformation->choice.choice_extension->value.present ==\
+               QoSInformation_ExtIEs__value_PR_DRB_Information)
+         {
+            drbInfo = &qoSInformation->choice.choice_extension->value.choice.DRB_Information; 
+            if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &lcCfg->snssai) != ROK)
+            {
+               DU_LOG("\nERROR  -->  DUAPP: Unable to extract Snssai information at procRlcLcCfg()");
+               return RFAILED;
+            }
+         }
+      }
+   }
 }
 
-
-
 /*******************************************************************
  *
  * @brief Fills DrbQos Info received by CU
@@ -7435,43 +7732,59 @@ void procRlcLcCfg(uint8_t rbId, uint8_t lcId, uint8_t rbType, uint8_t rlcMode,\
 
 void extractQosInfo(DrbQosInfo *qosToAdd, QoSFlowLevelQoSParameters_t *qosFlowCfg)
 {
+   uint8_t qosCntIdx = 0;
+   ProtocolExtensionContainer_4624P74_t *qosIeExt = NULLP;
+
    qosToAdd->fiveQiType = qosFlowCfg->qoS_Characteristics.present;
    qosToAdd->u.nonDyn5Qi.fiveQi     =\
-         qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->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);
+                                        *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow);
    }
    qosToAdd->u.nonDyn5Qi.maxDataBurstVol = \
-      *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume);
+                                           *(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);
+                                         *(qosFlowCfg->qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel);
    }
    qosToAdd->ngRanRetPri.priorityLevel = \
-      qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel; 
+                                         qosFlowCfg->nGRANallocationRetentionPriority.priorityLevel; 
    qosToAdd->ngRanRetPri.preEmptionCap = \
-      qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability;
+                                         qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionCapability;
    qosToAdd->ngRanRetPri.preEmptionVul = \
-      qosFlowCfg->nGRANallocationRetentionPriority.pre_emptionVulnerability;
+                                         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);
+            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);
+            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);
+            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);
+            qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.buf, \
+            qosFlowCfg->gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink.size);
+   }
+   /*Extracting PDU_SESSION_ID*/
+   qosIeExt = (ProtocolExtensionContainer_4624P74_t *)qosFlowCfg->iE_Extensions;
+   if(qosIeExt)
+   {
+      for(qosCntIdx = 0; qosCntIdx < qosIeExt->list.count; qosCntIdx++)
+      {
+         if(qosIeExt->list.array[qosCntIdx]->extensionValue.present == \
+               QoSFlowLevelQoSParameters_ExtIEs__extensionValue_PR_PDUSessionID)
+         {
+            qosToAdd->pduSessionId = qosIeExt->list.array[qosCntIdx]->extensionValue.choice.PDUSessionID;
+            DU_LOG("\nDEBUG -->  DU_F1AP : extractQosInfo: PDU SessionID:%d",qosToAdd->pduSessionId);
+         }
+      }  
    }
-   qosToAdd->pduSessionId = 0;
    qosToAdd->ulPduSessAggMaxBitRate = 0;
 }
 
@@ -7530,6 +7843,7 @@ uint8_t extractUpTnlInfo(uint8_t drbId, uint8_t configType,\
    }
    return ROK;
 }
+
 /*******************************************************************
 *
 * @brief Function to extract Drb Qos Cfg Info from CU
@@ -7562,21 +7876,10 @@ uint8_t extractDrbQosCfg(DRB_Information_t *drbInfo, LcCfg *macLcToAdd )
       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("\nERROR  -->  DUAPP : Memory failed at allocating SNSSAI at extractDrbQosCfg()");
-         return RFAILED;
-      }
-   }
-   memcpy(&macLcToAdd->snssai->sst, drbInfo->sNSSAI.sST.buf, \
-         drbInfo->sNSSAI.sST.size);
-   if(drbInfo->sNSSAI.sD)
+   if(extractDrbSnssaiCfg(&drbInfo->sNSSAI, &macLcToAdd->snssai) != ROK)
    {
-      memcpy(macLcToAdd->snssai->sd, drbInfo->sNSSAI.sD->buf, \
-            drbInfo->sNSSAI.sD->size);
+      DU_LOG("\nERROR  -->  DUAPP: Unable to extract Snssai information  at extractDrbQosCfg()");
+      return RFAILED;
    }
    return ROK;
 }
@@ -7837,7 +8140,7 @@ uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList
      /* 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]));
+     procRlcLcCfg(rbId, lcId, rbType, rlcMode, CONFIG_UNKNOWN, f1RlcCfg, &(ueCfgDb->rlcLcCfg[idx]), NULLP);
      if(procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, NULL, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx], NULL) != ROK)
      {
         DU_LOG("\nERROR  -->  DU APP : Failed while filling MAC LC config at extractRlcCfgToAddMod()");
@@ -8088,31 +8391,34 @@ void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg)
       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);
+         for(cRsetIdx = 0; cRsetIdx < cRsetToAddModList->list.count; cRsetIdx++)
+         {
+            macPdcchCfg->cRSetToAddModList[cRsetIdx].cRSetId = \
+               cRsetToAddModList->list.array[cRsetIdx]->controlResourceSetId;
+            //freqDomRsrcBitStringToInt(&cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources,\
+                  macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc);
+            memcpy(macPdcchCfg->cRSetToAddModList[cRsetIdx].freqDomainRsrc, \
+               cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources.buf,
+               cRsetToAddModList->list.array[cRsetIdx]->frequencyDomainResources.size);
+
             macPdcchCfg->cRSetToAddModList[cRsetIdx].duration = \
-             cRsetToAddModList->list.array[cRsetIdx]->duration;
+                cRsetToAddModList->list.array[cRsetIdx]->duration;
 
-           macPdcchCfg->cRSetToAddModList[cRsetIdx].cceRegMappingType = \
-             cRsetToAddModList->list.array[cRsetIdx]->cce_REG_MappingType.present;   
+            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
+            {
+               //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);
-           }
+                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)
@@ -8121,10 +8427,10 @@ void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg)
       if(cRsetToRelList->list.count)
       {
          macPdcchCfg->numCRsetToRel = cRsetToRelList->list.count;
-        for(cRsetIdx = 0; cRsetIdx < cRsetToRelList->list.count; cRsetIdx++)
-        {
+         for(cRsetIdx = 0; cRsetIdx < cRsetToRelList->list.count; cRsetIdx++)
+         {
             macPdcchCfg->cRSetToRelList[cRsetIdx] = *(cRsetToRelList->list.array[cRsetIdx]);
-        }
+         }
       }
    }
 
@@ -8135,49 +8441,49 @@ void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg)
       if(srchSpcToAddModList->list.count)
       {
          macPdcchCfg->numSearchSpcToAddMod = srchSpcToAddModList->list.count;
-        for(srchSpcIdx = 0; srchSpcIdx < srchSpcToAddModList->list.count; srchSpcIdx++)
-        {
+         for(srchSpcIdx = 0; srchSpcIdx < srchSpcToAddModList->list.count; srchSpcIdx++)
+         {
             macPdcchCfg->searchSpcToAddModList[srchSpcIdx].searchSpaceId =\
-              srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceId;
+                                                                          srchSpcToAddModList->list.array[srchSpcIdx]->searchSpaceId;
             macPdcchCfg->searchSpcToAddModList[srchSpcIdx].cRSetId =\
-              *(srchSpcToAddModList->list.array[srchSpcIdx]->controlResourceSetId);
-           if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset)
-           {
+                                                                    *(srchSpcToAddModList->list.array[srchSpcIdx]->controlResourceSetId);
+            if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset)
+            {
                macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSlotPeriodicityAndOffset =\
-                 srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset->present;
+                                                                                         srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSlotPeriodicityAndOffset->present;
             }
             if(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot)
             {
-              bitStringToInt(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot,\
-                 macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSymbolsWithinSlot);
+               bitStringToInt(srchSpcToAddModList->list.array[srchSpcIdx]->monitoringSymbolsWithinSlot,\
+                     macPdcchCfg->searchSpcToAddModList[srchSpcIdx].mSymbolsWithinSlot);
             }
-           if(srchSpcToAddModList->list.array[srchSpcIdx]->nrofCandidates)
+            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;
-           }
+               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;
-              }
-         
-           }
-        }
+            {
+               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 */
@@ -8187,11 +8493,11 @@ void extractPdcchCfg(PDCCH_Config_t *cuPdcchCfg, PdcchConfig *macPdcchCfg)
       if(srchSpcToRelList->list.count)
       {
          macPdcchCfg->numSearchSpcToRel = srchSpcToRelList->list.count;
-        for(srchSpcIdx = 0; srchSpcIdx < srchSpcToRelList->list.count; srchSpcIdx++)
-        {
+         for(srchSpcIdx = 0; srchSpcIdx < srchSpcToRelList->list.count; srchSpcIdx++)
+         {
             macPdcchCfg->searchSpcToRelList[srchSpcIdx] =\
-              *(srchSpcToRelList->list.array[srchSpcIdx]);
-        }
+                                                         *(srchSpcToRelList->list.array[srchSpcIdx]);
+         }
       }
    }
 }
@@ -8589,8 +8895,16 @@ void extractResrcSetToAddModList(PucchResrcSetCfg *macRsrcSetList, struct PUCCH_
          macRsrcSetList->resrcSetToAddModList[arrIdx].resrcList[rsrcListIdx] =\
             *cuRsrcSetList->list.array[arrIdx]->resourceList.list.array[rsrcListIdx];
       }
-      macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize =\
-         *cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1;
+
+      if(cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1)
+      {
+         macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize =\
+            *cuRsrcSetList->list.array[arrIdx]->maxPayloadMinus1;
+      }
+      else
+      {
+         macRsrcSetList->resrcSetToAddModList[arrIdx].maxPayLoadSize = 0;
+      }
    }
 }/* End of extractResrcSetToAddModList */
 
@@ -9143,7 +9457,21 @@ ServCellCfgInfo *storedSrvCellCfg)
          if(dlBwp->pdcch_Config->choice.setup)
          {
             macSrvCellCfg->initDlBwp.pdcchPresent = true;
-            extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
+            if(storedSrvCellCfg)
+            {
+               if(!storedSrvCellCfg->initDlBwp.pdcchPresent)
+               {
+                  extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
+               }
+               else
+               {
+                  extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
+               }
+            }
+            else
+            {
+               extractPdcchCfg(dlBwp->pdcch_Config->choice.setup, &macSrvCellCfg->initDlBwp.pdcchCfg);
+            }
          }
       }
       if(dlBwp->pdsch_Config)
@@ -9967,19 +10295,18 @@ CellGroupConfigRrc_t *extractCellGrpInfo(ProtocolExtensionContainer_4624P16_t *p
  * ****************************************************************/
 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);
+   procRlcLcCfg(srbItem->sRBID, srbItem->sRBID, RB_TYPE_SRB, RLC_AM, CONFIG_ADD, NULL, rlcLcToAdd, NULL);
 
    /* Filling MAC INFO */
-   ret = procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL,NULL, NULL, NULL, macLcToAdd, NULL);
-   if(ret == RFAILED)
+   if(procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL,NULL, NULL, NULL, macLcToAdd, NULL)  != ROK)
    { 
       DU_LOG("\nERROR  -->  F1AP : Failed at MAC LC Cfg in procSrbListToSetup()");
-      return ret;
+      return RFAILED;
    }
-   return ret;
+
+   return ROK;
 }
 
 
@@ -10055,21 +10382,24 @@ uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb)
  *    Functionality: Fills Drb List received by CU
  *                   for both MAC and RLC
  *
- * @params[in] SRBs_ToBeSetup_Item_t pointer
- *             LcCfg pointer,
- *             RlcBearerCfg pointer
+ * @params[in] DRBs_ToBeSetup_Item_t , DRBs_ToBeSetupMod_Item_t,
+ *             DRBs_ToBeModified_Item_t , lcId, LcCfg pointer,
+ *             RlcBearerCfg , UpTnlCfg, RlcUeCfg
  * @return void
  *
  * ****************************************************************/
 
 uint8_t procDrbListToSetupMod(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem,\
-DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo)
+DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo, RlcUeCfg *storedRlcUeCfg)
 {
+   uint8_t cfgIdx = 0;
+   RlcMode rlcModeInfo;
 
    if(drbItem != NULLP)
    {
       /* Filling RLC INFO */
-      procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd);
+      procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd, &drbItem->\
+      qoSInformation);
 
       /* Filling MAC INFO */
       if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
@@ -10080,7 +10410,8 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem,
    }
    else if(drbSetupModItem != NULLP)
    {
-      procRlcLcCfg(drbSetupModItem->dRBID, lcId, RB_TYPE_DRB, drbSetupModItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd);
+      procRlcLcCfg(drbSetupModItem->dRBID, lcId, RB_TYPE_DRB, drbSetupModItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd, 
+      &drbSetupModItem->qoSInformation);
 
       if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, NULL, drbSetupModItem, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
       {
@@ -10092,6 +10423,19 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem,
    {
       /* Drb to Mod IEs doesnot have rlcMode to be modified
        * in ASN. Hence no change in RLC configurations */
+      if(storedRlcUeCfg != NULLP)
+      {
+         for(cfgIdx = 0; cfgIdx < storedRlcUeCfg->numLcs; cfgIdx++)
+         {
+            if(storedRlcUeCfg->rlcLcCfg[cfgIdx].lcId == lcId)
+            {
+               rlcModeInfo = storedRlcUeCfg->rlcLcCfg[cfgIdx].rlcMode;
+               break;
+            }
+         }
+      }
+
+      procRlcLcCfg(drbModItem->dRBID, lcId, RB_TYPE_DRB, rlcModeInfo, CONFIG_MOD, NULL, rlcLcToAdd, drbModItem->qoSInformation);
       if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_MOD, NULL, NULL, drbModItem, NULL, macLcToAdd, upTnlInfo) != ROK)
       {
          DU_LOG("\nERROR  --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
@@ -10119,9 +10463,9 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem,
  * ****************************************************************/
 
 uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMod_List_t *drbSetupModCfg,\
- DRBs_ToBeModified_List_t *drbModCfg, uint8_t drbCount, DuUeCfg *ueCfgDb, uint32_t *drbBitMap)
+ DRBs_ToBeModified_List_t *drbModCfg, uint8_t drbCount, DuUeCfg *ueCfgDb, uint32_t *drbBitMap, RlcUeCfg *rlcUeCfg)
 {
-   uint8_t ret, drbIdx, lcId = 0;
+   uint8_t ret, drbIdx = 0, lcId = 0;
    DRBs_ToBeSetup_Item_t *drbItem = NULLP;
    DRBs_ToBeSetupMod_ItemIEs_t *drbSetupModItem = NULLP;
    DRBs_ToBeModified_ItemIEs_t *drbModItem = NULLP;
@@ -10157,7 +10501,7 @@ uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMo
             } 
             ret = procDrbListToSetupMod(lcId, NULL, NULL, &(drbModItem->value.choice.DRBs_ToBeModified_Item),\
             &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs],\
-            &ueCfgDb->upTnlInfo[ueCfgDb->numDrb]);
+            &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
             if(ret == RFAILED)
             {
                DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetupMod() for Modified List");
@@ -10178,7 +10522,7 @@ uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMo
             {
                drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
                ret = procDrbListToSetupMod(lcId, drbItem, NULL, NULL, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\
-                     &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], &ueCfgDb->upTnlInfo[ueCfgDb->numDrb]);
+                     &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
                if(ret == RFAILED)
                {
                   DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetup List");
@@ -10190,15 +10534,16 @@ uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMo
                drbSetupModItem = (DRBs_ToBeSetupMod_ItemIEs_t *) drbSetupModCfg->list.array[drbIdx];
                ret = procDrbListToSetupMod(lcId, NULL, &(drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item), NULL,\
                      &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs],\
-                     &ueCfgDb->upTnlInfo[ueCfgDb->numDrb]);
+                     &ueCfgDb->upTnlInfo[ueCfgDb->numDrb], rlcUeCfg);
                if(ret == RFAILED)
                {
                   DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetupMod List");
                   break;
                }
+               ueCfgDb->numDrbSetupMod++;
             }
-            ueCfgDb->numRlcLcs++;
          }
+         ueCfgDb->numRlcLcs++;
          ueCfgDb->numMacLcs++;
          ueCfgDb->numDrb++;
  
@@ -10541,7 +10886,7 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
             {
                   drbCfg = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List;
 
-                  if(extractDrbListToSetupMod(drbCfg, NULL, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap))
+                  if(extractDrbListToSetupMod(drbCfg, NULL, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULLP))
                   {
                      DU_LOG("\nERROR  -->  DU APP : Failed at extractDrbListToSetupMod()");
                      //TODO: Update the failure cause in ue context Setup Response
@@ -12053,7 +12398,7 @@ void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck)
 uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
 {
    uint8_t  ieIdx=0, arrIdx=0,ret=ROK;
-   uint8_t  ueId =0 , ueIdx =0;
+   uint8_t  ueId =0 , ueIdx =0, totalActiveUe = 0;
    uint16_t cellId =0, cellIdx =0, crnti=0;
    CmLList *f1apPduNode = NULLP;
    ReservedF1apPduInfo *f1apPduInfo =NULLP;
@@ -12105,28 +12450,38 @@ uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
                            ret = duSendCellDeletReq(cellId);
                            if(ret == RFAILED)
                            {
-                              DU_LOG("ERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to send cell delete\
+                              DU_LOG("\nERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to send cell delete\
                               request for cellId[%d]", cellId);
                            }
                         }
                         else
                         {
-                           for(ueIdx = 0; ueIdx < duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++)
+                           totalActiveUe = duCb.actvCellLst[cellIdx]->numActvUes;
+                           while(totalActiveUe)
                            {
+                              if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].ueState != UE_ACTIVE)
+                              {
+                                 ueIdx++;
+                                 continue;
+                              }
+
                               crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
                               GET_UE_IDX(crnti,ueId);
+                              /* Sending Ue Context release request only for maximum supporting UEs */
                               ret = BuildAndSendUeContextReleaseReq(cellId, ueId);
                               if(ret == RFAILED)
                               {
-                                 DU_LOG("ERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to build and send UE delete\
+                                 DU_LOG("\nERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): Failed to build and send UE delete\
                                  request for cellId[%d]", cellId);
                               }
+                              ueIdx++;
+                              totalActiveUe--;
                            }
                         }
                      }
                      else
                      {
-                        DU_LOG("ERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%d] not found", cellId);
+                        DU_LOG("\nERROR  --> DU_APP : duProcGnbDuCfgUpdAckMsg(): CellId [%d] not found", cellId);
                         ret = RFAILED;
                      }
                      break;
@@ -12369,7 +12724,7 @@ uint8_t BuildDrbSetupModList(DRBs_SetupMod_List_t *drbSet , DuUeCfg *ueCfg)
    uint8_t drbCnt =0;
    struct DRBs_SetupMod_ItemIEs *drbItemIe;
 
-   drbCnt = 1;
+   drbCnt = ueCfg->numDrbSetupMod;
    drbSet->list.count = drbCnt;
    drbSet->list.size = drbCnt * sizeof(DRBs_SetupMod_ItemIEs_t *);
    DU_ALLOC(drbSet->list.array, drbSet->list.size);
@@ -12947,7 +13302,7 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
                               choice.DRBs_ToBeSetupMod_List;
                               
                               if(extractDrbListToSetupMod(NULL, drbSetupModCfg, NULL, drbSetupModCfg->list.count,\
-                                    &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap))
+                              &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, NULL))
                               {
                                  DU_LOG("\nERROR  -->  DU APP : Failed at extractDrbListToSetupMod() for DrbSetupModList");
                                  ret = RFAILED;
@@ -12960,8 +13315,8 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
                            {
                               drbModifiedCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
                               choice.DRBs_ToBeModified_List;
-                              if(extractDrbListToSetupMod(NULL, NULL, drbModifiedCfg, drbSetupModCfg->list.count,\
-                                 &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap))
+                              if(extractDrbListToSetupMod(NULL, NULL, drbModifiedCfg, drbModifiedCfg->list.count,\
+                                 &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap, &duUeCb->rlcUeCfg))
                               {
                                  DU_LOG("\nERROR  -->  DU APP : Failed at extractDrbListToSetupMod() for DrbModifiedList");
                                  ret = RFAILED;
@@ -13337,7 +13692,7 @@ uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1
       break;
    }while(true);
    
-   if(ret == ROK)
+   if(ret == ROK && (duCb.actvCellLst[cellId-1]->numActvUes == 0))
    {
       duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS;
       ret = duSendCellDeletReq(cellId);
@@ -13462,7 +13817,7 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
                   {
                      for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++)
                      {
-                        for(ueIdx = 0; ueIdx < duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++)
+                        for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
                         {
                            if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
                                  (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
@@ -13511,7 +13866,7 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
                      }
                      if(!ueIdxFound)
                      {
-                        DU_LOG("\nERROR  -->  F1AP: DuUeCb is not found at procF1UeContextSetupReq()");
+                        DU_LOG("\nERROR  -->  F1AP: DuUeCb is not found at procF1UeContextReleaseCommand()");
                         ret = RFAILED;
                      }