New Fixes for cell bring up post cell down for CLA 43/6343/4
authorlal.harshita <Harshita.Lal@radisys.com>
Tue, 15 Jun 2021 09:47:06 +0000 (15:17 +0530)
committerlal.harshita <Harshita.Lal@radisys.com>
Wed, 23 Jun 2021 10:26:29 +0000 (15:56 +0530)
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
Change-Id: If0fbf75dacdf383728f09e88c6f0cdd7a3093367
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
17 files changed:
src/5gnrmac/mac_cfg_hdl.c
src/5gnrmac/mac_ue_mgr.c
src/5gnrrlc/rlc_utils.h
src/5gnrsch/sch_ue_mgr.c
src/5gnrsch/sch_utils.h
src/cm/du_app_mac_inf.c
src/cm/du_app_mac_inf.h
src/cu_stub/cu_f1ap_msg_hdl.c
src/cu_stub/cu_stub_sctp.c
src/du_app/du_cell_mgr.c
src/du_app/du_f1ap_msg_hdl.c
src/du_app/du_mgr.h
src/du_app/du_msg_hdl.c
src/du_app/du_sctp.c
src/du_app/du_ue_mgr.c
src/phy_stub/phy_stub_msg_hdl.c
src/phy_stub/phy_stub_thread_hdl.c

index f0a50e5..685b923 100644 (file)
@@ -49,6 +49,19 @@ SchCellCfgFunc SchCellCfgOpts[] =
    packSchCellCfg    /* packing for light weight loosly coupled */
 };
 
+MacSchCellDeleteReqFunc macSchCellDeleteReqOpts[]=
+{
+   packMacSchCellDeleteReq,    /* packing for loosely coupled */
+   MacSchCellDeleteReq,        /* packing for tightly coupled */
+   packMacSchCellDeleteReq     /* packing for light weight loosely coupled */
+};
+
+MacDuCellDeleteRspFunc macDuCellDeleteRspOpts[] =
+{
+   packDuMacCellDeleteRsp,   /* packing for loosely coupled */
+   DuProcMacCellDeleteRsp,   /* packing for tightly coupled */
+   packDuMacCellDeleteRsp   /* packing for light weight loosly coupled */
+};
 
 /**
  * @brief Layer Manager  Configuration request handler for Scheduler
@@ -389,6 +402,215 @@ void fapiMacConfigRsp(uint16_t cellId)
    MacSendCellCfgCfm(cellId, RSP_OK);
 }
 
+/*******************************************************************
+ *
+ * @brief Fill and Send Cell Delete response from MAC to DU APP
+ *
+ * @details
+ *
+ *    Function : MacSendCellDeleteRsp
+ *
+ *    Functionality: Fill and Send Cell Delete response from MAC to DUAPP
+ *
+ * @params[in] MAC Cell delete result
+ *             SCH Cell delete response
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t MacSendCellDeleteRsp(CellDeleteStatus result, uint8_t cellId)
+{
+   MacCellDeleteRsp *deleteRsp=NULLP;
+   Pst            rspPst;
+
+   MAC_ALLOC_SHRABL_BUF(deleteRsp, sizeof(MacCellDeleteRsp));
+   if(!deleteRsp)
+   {
+      DU_LOG("\nERROR  -->  MAC : MacSendCellDeleteRsp(): Memory allocation for Cell delete response failed");
+      return RFAILED;
+   }
+
+   /* Filling CELL delete response */
+   
+   memset(deleteRsp, 0, sizeof(MacCellDeleteRsp));
+   deleteRsp->cellId = cellId;
+   deleteRsp->result = result;
+
+   /* Fill Post structure and send CELL delete response*/
+   memset(&rspPst, 0, sizeof(Pst));
+   FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_CELL_DELETE_RSP);
+   return (*macDuCellDeleteRspOpts[rspPst.selector])(&rspPst, deleteRsp);
+}
+
+/*******************************************************************
+ *
+ * @brief  Processes CELL delete response from scheduler
+ *
+ * @details
+ *
+ *    Function : MacProcSchCellDeleteRsp
+ *
+ *    Functionality:
+ *      Processes CELL delete from scheduler
+ *
+ * @params[in] Pst : Post structure
+ *             schCellDelRsp : Scheduler CELL delete respons
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * * ****************************************************************/
+uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDelRsp)
+{
+   uint8_t  ret = ROK;
+   uint16_t cellIdx=0;
+   CellDeleteStatus status;
+
+   if(schCellDelRsp)
+   {
+      if(schCellDelRsp->rsp == RSP_OK)
+      {
+         DU_LOG("\nINFO   -->  MAC : SCH CELL Delete response for cellId[%d] is successful ", \
+         schCellDelRsp->cellId);
+         GET_CELL_IDX(schCellDelRsp->cellId, cellIdx);
+         if(macCb.macCell[cellIdx])
+         {
+            if(macCb.macCell[cellIdx]->cellId == schCellDelRsp->cellId)
+            {
+               memset(macCb.macCell[cellIdx], 0, sizeof(MacCellCb));
+               status  = SUCCESSFUL_RSP;
+               MAC_FREE(macCb.macCell[cellIdx], sizeof(MacCellCb));
+            }
+            else
+            {
+                DU_LOG("ERROR  -->  MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId);
+                status = CELL_ID_INVALID;
+                ret = RFAILED;
+            }
+         }
+         else
+         {
+            DU_LOG("ERROR  -->  MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId);
+            status = CELL_ID_INVALID;
+            ret = RFAILED;
+         }
+      }
+      else
+      {
+         DU_LOG("ERROR  -->  MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId);
+         status = CELL_ID_INVALID;
+         ret = RFAILED;
+      }
+      if(MacSendCellDeleteRsp(status, schCellDelRsp->cellId) != ROK)
+      {
+         DU_LOG("\nERROR  -->  MAC: MacProcSchCellDeleteRsp(): Failed to send CELL delete response");
+         ret = RFAILED;
+      }
+
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->  MAC: MacProcSchCellDeleteRsp(): schCellDelRsp is NULL");
+      ret = RFAILED;
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Sends Cell delete req to Scheduler
+ *
+ * @details
+ *
+ *    Function : sendCellDelReqToSch
+ *
+ *    Functionality: sends Cell delete req to Scheduler
+ *
+ * @params[in]  SchCellDelete *schCellDel
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t sendCellDelReqToSch(SchCellDelete *schCellDel)
+{
+   Pst schPst;
+   FILL_PST_MAC_TO_SCH(schPst, EVENT_CELL_DELETE_REQ_TO_SCH);
+   return(*macSchCellDeleteReqOpts[schPst.selector])(&schPst, schCellDel);
+}
+
+/*******************************************************************
+ *
+ * @brief Handles CELL Delete requst from DU APP
+ *
+ * @details
+ *
+ *    Function : MacProcCellDeleteReq
+ *
+ *    Functionality: Handles CELL Delete requst from DU APP
+ *
+ * @params[in] Pst *pst, MacCellDelete *cellDelete
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ *
+ * ****************************************************************/
+uint8_t MacProcCellDeleteReq(Pst *pst, MacCellDelete *cellDelete)
+{
+   uint8_t ret = ROK, cellIdx=0;
+   SchCellDelete schCellDelete;
+
+   DU_LOG("\nINFO   -->  MAC : Cell Delete Request received for cellId[%d]", cellDelete->cellId);
+
+   if(cellDelete)
+   {
+      GET_CELL_IDX(cellDelete->cellId, cellIdx);
+      if(macCb.macCell[cellIdx])
+      {
+         if(macCb.macCell[cellIdx]->cellId == cellDelete->cellId)
+         {
+            memset(&schCellDelete, 0, sizeof(SchCellDelete));
+            schCellDelete.cellId =  cellDelete->cellId;
+            ret = sendCellDelReqToSch(&schCellDelete);
+            if(ret != ROK)
+            {
+               DU_LOG("\nERROR  -->  MAC : MacProcCellDeleteReq(): Failed to send UE Delete Request to SCH");
+               ret = RFAILED;
+            }
+         }
+         else
+         {
+            DU_LOG("\nERROR  -->  MAC : MacProcCellDeleteReq(): Failed to find the MacUeCb of CellId = %d",\
+            cellDelete->cellId);
+            ret = RFAILED;
+         }
+      }
+      else
+      {
+         DU_LOG("\nERROR  -->  MAC : MacProcCellDeleteReq(): Failed to find the MacUeCb of CellId = %d",\
+               cellDelete->cellId);
+         ret = RFAILED;
+      }
+
+      if(ret == RFAILED)
+      {
+          DU_LOG("\nERROR  -->  MAC : MacProcCellDeleteReq(): Sending failure response to DU");
+          if(MacSendCellDeleteRsp(CELL_ID_INVALID, cellDelete->cellId) != ROK)
+          {
+             DU_LOG("\nERROR  -->  MAC : MacProcCellDeleteReq(): failed to send cell delete rsp for cellID[%d]",\
+             cellDelete->cellId);
+          }
+
+      }
+      MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellDelete, sizeof(MacCellDelete));
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->  MAC : MacProcCellDeleteReq(): Received MacCellDelete is NULL");
+      ret = RFAILED;
+   }
+   return ret;
+}
+
 /**********************************************************************
   End of file
  **********************************************************************/
index 965e2f7..dcd84c7 100644 (file)
@@ -64,20 +64,6 @@ MacDuUeDeleteRspFunc macDuUeDeleteRspOpts[] =
    packDuMacUeDeleteRsp   /* packing for light weight loosly coupled */
 };
 
-MacSchCellDeleteReqFunc macSchCellDeleteReqOpts[]=
-{
-   packMacSchCellDeleteReq,    /* packing for loosely coupled */
-   MacSchCellDeleteReq,        /* packing for tightly coupled */
-   packMacSchCellDeleteReq     /* packing for light weight loosely coupled */
-};
-
-MacDuCellDeleteRspFunc macDuCellDeleteRspOpts[] =
-{
-   packDuMacCellDeleteRsp,   /* packing for loosely coupled */
-   DuProcMacCellDeleteRsp,   /* packing for tightly coupled */
-   packDuMacCellDeleteRsp   /* packing for light weight loosly coupled */
-};
-
 /*******************************************************************
  *
  * @brief Fills mac cell group config to be sent to scheduler
@@ -199,7 +185,7 @@ uint8_t fillPdschServCellCfg(PdschServCellCfg macPdschCfg, SchPdschServCellCfg *
    {
       if(!schPdschCfg->maxMimoLayers)
       {
-         MAC_ALLOC_SHRABL_BUF(schPdschCfg->maxMimoLayers, sizeof(uint8_t));
+         MAC_ALLOC(schPdschCfg->maxMimoLayers, sizeof(uint8_t));
         if(!schPdschCfg->maxMimoLayers)
         {
             DU_LOG("\nERROR  -->  MAC :Memory Alloc MimoLayers Failed at fillPdschServCellCfg()");
@@ -220,7 +206,7 @@ uint8_t fillPdschServCellCfg(PdschServCellCfg macPdschCfg, SchPdschServCellCfg *
    {
       if(!schPdschCfg->maxCodeBlkGrpPerTb)
       {
-         MAC_ALLOC_SHRABL_BUF(schPdschCfg->maxCodeBlkGrpPerTb, sizeof(SchMaxCodeBlkGrpPerTB));
+         MAC_ALLOC(schPdschCfg->maxCodeBlkGrpPerTb, sizeof(SchMaxCodeBlkGrpPerTB));
         if(!schPdschCfg->maxCodeBlkGrpPerTb)
         {
             DU_LOG("\nERROR  -->  MAC :Memory Alloc for code Block Failed at fillPdschServCellCfg()");
@@ -238,7 +224,7 @@ uint8_t fillPdschServCellCfg(PdschServCellCfg macPdschCfg, SchPdschServCellCfg *
    {
       if(!schPdschCfg->codeBlkGrpFlushInd)
       {
-         MAC_ALLOC_SHRABL_BUF(schPdschCfg->codeBlkGrpFlushInd, sizeof(bool));
+         MAC_ALLOC(schPdschCfg->codeBlkGrpFlushInd, sizeof(bool));
         if(!schPdschCfg->codeBlkGrpFlushInd)
         {
             DU_LOG("\nERROR  -->  MAC :Memory Alloc for Flush Ind Failed at fillPdschServCellCfg()");
@@ -256,7 +242,7 @@ uint8_t fillPdschServCellCfg(PdschServCellCfg macPdschCfg, SchPdschServCellCfg *
    {
       if(!schPdschCfg->xOverhead)
       {
-         MAC_ALLOC_SHRABL_BUF(schPdschCfg->xOverhead, sizeof(SchPdschXOverhead));
+         MAC_ALLOC(schPdschCfg->xOverhead, sizeof(SchPdschXOverhead));
         if(!schPdschCfg->xOverhead)
         {
             DU_LOG("\nERROR  -->  MAC :Memory Alloc for xOverHead Failed at fillPdschServCellCfg()");
@@ -2524,96 +2510,6 @@ void deletePucchResourcesCfg(PucchResrcCfg *resrcCfg)
 
 }
 
-/*******************************************************************
-*
-* @brief Function to delete MAC Pdsch ServCellCfg
-*
-* @details
-*
-*    Function : deleteMacPdschServCellCfg
-*
-*    Functionality: Function to delete MAC Pdsch ServCellCfg
-*
-* @params[in] PdschServCellCfg *pdschServCellCfg
-* @return void
-*
-* ****************************************************************/
-
-void deleteMacPdschServCellCfg(PdschServCellCfg *pdschServCellCfg)
-{
-   MAC_FREE(pdschServCellCfg->maxMimoLayers, sizeof(uint8_t));
-   MAC_FREE(pdschServCellCfg->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
-   MAC_FREE(pdschServCellCfg->codeBlkGrpFlushInd, sizeof(bool));
-   MAC_FREE(pdschServCellCfg->xOverhead, sizeof(PdschXOverhead));
-}
-
-/*******************************************************************
-*
-* @brief Handles UE Delete requst from DU APP
-*
-* @details
-*
-*    Function : deleteMacUeCb 
-*
-*    Functionality: Handles UE Delete requst from DU APP
-*
-* @params[in] MacCellCb *cellCb,uint16_t ueIdx
-* @return ROK     - success
-*         RFAILED - failure
-*
-* ****************************************************************/
-
-void deleteMacUeCb(MacUeCb  *ueCb)
-{
-   MacUeCfg *ueCfg = NULLP;
-   ServCellCfgInfo *servCellCfg;
-   
-   if(ueCb->cellCb)
-   {
-      MAC_FREE(ueCb->cellCb->macRaCb[ueCb->ueIdx-1].msg4Pdu,  ueCb->cellCb->macRaCb[ueCb->ueIdx-1].msg4PduLen);
-      MAC_FREE(ueCb->cellCb->macRaCb[ueCb->ueIdx-1].msg4TxPdu, ueCb->cellCb->macRaCb[ueCb->ueIdx-1].msg4TbSize);
-      
-      if(ueCb->cellCb->ueCfgTmpData[ueCb->ueIdx-1])
-      {
-         ueCfg =ueCb->cellCb->ueCfgTmpData[ueCb->ueIdx-1]; 
-         MAC_FREE(ueCfg->ambrCfg, sizeof(AmbrCfg));
-         if(ueCfg->spCellCfgPres)
-         {
-            servCellCfg = &ueCfg->spCellCfg.servCellCfg;
-            MAC_FREE(servCellCfg->bwpInactivityTmr, sizeof(uint8_t));
-            
-            if(servCellCfg->initUlBwp.pucchPresent)
-            {
-               MAC_FREE(servCellCfg->initUlBwp.pucchCfg.resrcSet, sizeof(PucchResrcSetCfg));
-               
-               if(servCellCfg->initUlBwp.pucchCfg.resrc)
-               {
-                  deletePucchResourcesCfg(servCellCfg->initUlBwp.pucchCfg.resrc);
-                  MAC_FREE(servCellCfg->initUlBwp.pucchCfg.resrc, sizeof(PucchResrcCfg));
-               }
-               MAC_FREE(servCellCfg->initUlBwp.pucchCfg.format1, sizeof(PucchFormatCfg));
-               MAC_FREE(servCellCfg->initUlBwp.pucchCfg.format2, sizeof(PucchFormatCfg));
-               MAC_FREE(servCellCfg->initUlBwp.pucchCfg.format3, sizeof(PucchFormatCfg));
-               MAC_FREE(servCellCfg->initUlBwp.pucchCfg.format4, sizeof(PucchFormatCfg));
-               MAC_FREE(servCellCfg->initUlBwp.pucchCfg.schedReq, sizeof(PucchSchedReqCfg));
-               MAC_FREE(servCellCfg->initUlBwp.pucchCfg.multiCsiCfg, sizeof(PucchMultiCsiCfg));
-               MAC_FREE(servCellCfg->initUlBwp.pucchCfg.spatialInfo, sizeof(PucchSpatialCfg));
-               MAC_FREE(servCellCfg->initUlBwp.pucchCfg.dlDataToUlAck , sizeof(PucchDlDataToUlAck));
-               MAC_FREE(servCellCfg->initUlBwp.pucchCfg.powerControl, sizeof(PucchPowerControl));
-               deleteMacPdschServCellCfg(&servCellCfg->pdschServCellCfg);
-            }
-         }
-         for(uint8_t idx=0 ;idx < ueCfg->numLcs; idx++)
-         {
-            MAC_FREE(ueCfg->lcCfgList[idx].drbQos, sizeof(DrbQosInfo));
-            MAC_FREE(ueCfg->lcCfgList[idx].snssai, sizeof(Snssai));
-         }
-         MAC_FREE(ueCb->cellCb->ueCfgTmpData[ueCb->ueIdx-1],sizeof(MacUeCfg));
-      }
-   }
-   memset(ueCb, 0, sizeof(MacUeCb));
-}
-
 /*******************************************************************
 *
 * @brief  Processes UE delete response from scheduler
@@ -2650,7 +2546,7 @@ uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp)
             GET_UE_IDX(schUeDelRsp->crnti, ueIdx);
             if(macCb.macCell[cellIdx]->ueCb[ueIdx -1].crnti == schUeDelRsp->crnti)
             {
-               deleteMacUeCb(&macCb.macCell[cellIdx]->ueCb[ueIdx -1]);
+               memset(&macCb.macCell[cellIdx]->ueCb[ueIdx -1], 0, sizeof(MacUeCb));
                macCb.macCell[cellIdx]->numActvUe--;
                result = SUCCESS;
                ret = ROK;
@@ -2791,252 +2687,6 @@ uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete)
    return ret;
 }
 
-/*******************************************************************
- *
- * @brief Fill and Send Cell Delete response from MAC to DU APP
- *
- * @details
- *
- *    Function : MacSendCellDeleteRsp
- *
- *    Functionality: Fill and Send Cell Delete response from MAC to DUAPP
- *
- * @params[in] MAC Cell delete result
- *             SCH Cell delete response
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-uint8_t MacSendCellDeleteRsp(CellDeleteStatus result, uint8_t cellId)
-{
-   MacCellDeleteRsp *deleteRsp=NULLP;
-   Pst            rspPst;
-
-   MAC_ALLOC_SHRABL_BUF(deleteRsp, sizeof(MacCellDeleteRsp));
-   if(!deleteRsp)
-   {
-      DU_LOG("\nERROR  -->  MAC : MacSendCellDeleteRsp(): Memory allocation for Cell delete response failed");
-      return RFAILED;
-   }
-
-   /* Filling CELL delete response */
-   deleteRsp->cellId = cellId;
-   deleteRsp->result = result;
-
-   /* Fill Post structure and send CELL delete response*/
-   memset(&rspPst, 0, sizeof(Pst));
-   FILL_PST_MAC_TO_DUAPP(rspPst, EVENT_MAC_CELL_DELETE_RSP);
-   return (*macDuCellDeleteRspOpts[rspPst.selector])(&rspPst, deleteRsp);
-}
-
-/*******************************************************************
- *
- * @brief  delete MAC CellCb information
- *
- * @details
- *
- *    Function : deleteMacCellCb 
- *
- *    Functionality:
- *      delete MAC CellCb information
- *
- * @params[in] MacCellCb * cellCb 
- *             
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-void deleteMacCellCb(MacCellCb * cellCb)
-{
-   uint8_t idx;
-   for(idx=0; idx<MAX_SLOTS; idx++)  
-   {
-      MAC_FREE(cellCb->dlSlot[idx].dlInfo.rarAlloc, sizeof(RarAlloc));
-      if(cellCb->dlSlot[idx].dlInfo.ulGrant)
-      {
-         MAC_FREE(cellCb->dlSlot[idx].dlInfo.ulGrant->dciInfo.pdschCfg, sizeof(PdschCfg));
-         MAC_FREE(cellCb->dlSlot[idx].dlInfo.ulGrant, sizeof(DciInfo));
-      }
-      if(cellCb->dlSlot[idx].dlInfo.dlMsgAlloc)
-      {
-         MAC_FREE(cellCb->dlSlot[idx].dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPdu,\
-               cellCb->dlSlot[idx].dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPduLen);
-         MAC_FREE(cellCb->dlSlot[idx].dlInfo.dlMsgAlloc, sizeof(DlMsgAlloc));
-      }
-   }
-
-   memset(cellCb, 0, sizeof(MacCellCb));
-}
-
-/*******************************************************************
- *
- * @brief  Processes CELL delete response from scheduler
- *
- * @details
- *
- *    Function : MacProcSchCellDeleteRsp 
- *
- *    Functionality:
- *      Processes CELL delete from scheduler
- *
- * @params[in] Pst : Post structure
- *             schCellDelRsp : Scheduler CELL delete respons
- * @return ROK     - success
- *         RFAILED - failure
- *
- * * ****************************************************************/
-uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDelRsp)
-{
-   uint8_t  ret = ROK;
-   uint16_t cellIdx=0;
-   CellDeleteStatus status;
-   
-   if(schCellDelRsp)
-   {
-      if(schCellDelRsp->rsp == RSP_OK)
-      {
-         DU_LOG("\nINFO   -->  MAC : SCH CELL Delete response for cellId[%d] is successful ", \
-         schCellDelRsp->cellId);
-         GET_CELL_IDX(schCellDelRsp->cellId, cellIdx);
-         if(macCb.macCell[cellIdx]) 
-         {
-            if(macCb.macCell[cellIdx]->cellId == schCellDelRsp->cellId)
-            {
-               deleteMacCellCb(macCb.macCell[cellIdx]);
-               status  = SUCCESSFUL_RSP;
-               MAC_FREE(macCb.macCell[cellIdx], sizeof(MacCellCb));
-            }
-            else
-            {
-                DU_LOG("ERROR  -->  MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId);
-                status = CELL_ID_INVALID;
-                ret = RFAILED;
-            }
-         }
-         else
-         {
-            DU_LOG("ERROR  -->  MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId);
-            status = CELL_ID_INVALID;
-            ret = RFAILED;
-         }
-      }
-      else
-      {
-         DU_LOG("ERROR  -->  MAC : MacProcSchCellDeleteRsp(): CellId[%d] does not exists", schCellDelRsp->cellId);
-         status = CELL_ID_INVALID;
-         ret = RFAILED;
-      }
-      if(MacSendCellDeleteRsp(status, schCellDelRsp->cellId) != ROK)
-      {
-         DU_LOG("\nERROR  -->  MAC: MacProcSchCellDeleteRsp(): Failed to send CELL delete response");
-         ret = RFAILED;
-      }
-
-   }
-   else
-   {
-      DU_LOG("\nERROR  -->  MAC: MacProcSchCellDeleteRsp(): schCellDelRsp is NULL");
-      ret = RFAILED;
-   }
-   return ret;
-}
-
-/*******************************************************************
- *
- * @brief Sends Cell delete req to Scheduler
- *
- * @details
- *
- *    Function : sendCellDelReqToSch
- *
- *    Functionality: sends Cell delete req to Scheduler
- *
- * @params[in]  SchCellDelete *schCellDel
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-
-uint8_t sendCellDelReqToSch(SchCellDelete *schCellDel)
-{
-   Pst schPst;
-   FILL_PST_MAC_TO_SCH(schPst, EVENT_CELL_DELETE_REQ_TO_SCH);
-   return(*macSchCellDeleteReqOpts[schPst.selector])(&schPst, schCellDel);
-}
-
-/*******************************************************************
- *
- * @brief Handles CELL Delete requst from DU APP
- *
- * @details
- *
- *    Function : MacProcCellDeleteReq
- *
- *    Functionality: Handles CELL Delete requst from DU APP
- *
- * @params[in] Pst *pst, MacCellDelete *cellDelete
- * @return ROK     - success
- *         RFAILED - failure
- *
- *
- * ****************************************************************/
-uint8_t MacProcCellDeleteReq(Pst *pst, MacCellDelete *cellDelete)
-{
-   uint8_t ret = ROK, cellIdx=0;
-   SchCellDelete schCellDelete;
-
-   DU_LOG("\nINFO   -->  MAC : Cell Delete Request received for cellId[%d]", cellDelete->cellId);
-
-   if(cellDelete)
-   {
-      GET_CELL_IDX(cellDelete->cellId, cellIdx);
-      if(macCb.macCell[cellIdx])
-      {
-         if(macCb.macCell[cellIdx]->cellId == cellDelete->cellId)
-         {
-            memset(&schCellDelete, 0, sizeof(SchCellDelete));
-            schCellDelete.cellId =  cellDelete->cellId;
-            ret = sendCellDelReqToSch(&schCellDelete);
-            if(ret != ROK)
-            {
-               DU_LOG("\nERROR  -->  MAC : MacProcCellDeleteReq(): Failed to send UE Delete Request to SCH");
-               ret = RFAILED;
-            }
-         }
-         else
-         {
-            DU_LOG("\nERROR  -->  MAC : MacProcCellDeleteReq(): Failed to find the MacUeCb of CellId = %d",\
-            cellDelete->cellId);
-            ret = RFAILED;
-         }
-      }
-      else
-      {
-         DU_LOG("\nERROR  -->  MAC : MacProcCellDeleteReq(): Failed to find the MacUeCb of CellId = %d",\
-               cellDelete->cellId);
-         ret = RFAILED;
-      }
-
-      if(ret == RFAILED)
-      {
-          DU_LOG("\nERROR  -->  MAC : MacProcCellDeleteReq(): Sending failure response to DU");
-          if(MacSendCellDeleteRsp(CELL_ID_INVALID, cellDelete->cellId) != ROK)
-          {
-             DU_LOG("\nERROR  -->  MAC : MacProcCellDeleteReq(): failed to send cell delete rsp for cellID[%d]",\
-             cellDelete->cellId);
-          }
-
-      }
-      MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellDelete, sizeof(MacCellDelete));
-   }
-   else
-   {
-      DU_LOG("\nERROR  -->  MAC : MacProcCellDeleteReq(): Received MacCellDelete is NULL");
-      ret = RFAILED;
-   }
-   return ret;
-}
-
 /**********************************************************************
   End of file
  **********************************************************************/
index 5d15d17..51504f8 100755 (executable)
@@ -437,7 +437,7 @@ extern "C" {
 #define EVENT_RLC_UE_DELETE_TMR           8
 
 /* Wait time for RLC Timers */
-#define RLC_UE_DELETE_WAIT_TIME           1 /*in milliseconds */
+#define RLC_UE_DELETE_WAIT_TIME           5 /*in milliseconds */
 
 /*******************************************************************************
  *                              DBM Defines 
index a646589..a27c3e4 100644 (file)
@@ -234,12 +234,8 @@ uint8_t fillSchUeCb(SchUeCb *ueCb, SchUeCfg *ueCfg)
       ueCb->ueCfg.spCellCfgPres = true;
    }
    ueCb->state = SCH_UE_STATE_ACTIVE;
-   if(ueCfg->ambrCfg != NULLP)
-   {
-      SCH_ALLOC(ueCb->ueCfg.ambrCfg , sizeof(SchAmbrCfg));
-      memcpy(&ueCb->ueCfg.ambrCfg->ulBr , &ueCfg->ambrCfg->ulBr, sizeof(SchAmbrCfg));
-   }
    
+   ueCb->ueCfg.ambrCfg =  ueCfg->ambrCfg;
    memcpy(&ueCb->ueCfg.dlModInfo,  &ueCfg->dlModInfo , sizeof(SchModulationInfo));
    memcpy(&ueCb->ueCfg.ulModInfo,  &ueCfg->ulModInfo , sizeof(SchModulationInfo));
 
@@ -917,17 +913,10 @@ void deleteSchCellCb(SchCellCb *cellCb)
       {
          if(cellCb->schDlSlotInfo[idx])
          {
-            SCH_FREE(cellCb->schDlSlotInfo[idx]->rarInfo, sizeof(RarInfo));
-            if(cellCb->schDlSlotInfo[idx]->dlMsgInfo)
-            {
-               SCH_FREE(cellCb->schDlSlotInfo[idx]->dlMsgInfo->dlMsgPdu,\
-                     cellCb->schDlSlotInfo[idx]->dlMsgInfo->dlMsgPduLen);
-               SCH_FREE(cellCb->schDlSlotInfo[idx]->dlMsgInfo, sizeof(DlMsgInfo));
-            }
             SCH_FREE(cellCb->schDlSlotInfo[idx], sizeof(SchDlSlotInfo));
          }
       }
-      SCH_FREE(cellCb->schDlSlotInfo, sizeof(SchDlSlotInfo));
+      SCH_FREE(cellCb->schDlSlotInfo, cellCb->numSlots *sizeof(SchDlSlotInfo*));
    }
    if(cellCb->schUlSlotInfo)
    {
@@ -935,14 +924,13 @@ void deleteSchCellCb(SchCellCb *cellCb)
       {
          if(cellCb->schUlSlotInfo[idx])
          {
-            SCH_FREE(cellCb->schUlSlotInfo[idx]->schPuschInfo,sizeof(SchPuschInfo));
             SCH_FREE(cellCb->schUlSlotInfo[idx], sizeof(SchUlSlotInfo));  
          }
       }
-      SCH_FREE(cellCb->schUlSlotInfo, sizeof(SchUlSlotInfo));
+      SCH_FREE(cellCb->schUlSlotInfo,  cellCb->numSlots * sizeof(SchUlSlotInfo*));
    }
-   SCH_FREE(cellCb->cellCfg.sib1SchCfg.sib1PdcchCfg.dci.pdschCfg, sizeof(PdschCfg));
    memset(cellCb, 0, sizeof(SchCellCb));
+
 }
 
 /*******************************************************************
index 1953784..5d1807a 100644 (file)
@@ -66,7 +66,7 @@
    if(_datPtr)                                                  \
    {                                                            \
       SPutSBuf(SCH_MEM_REGION, SCH_POOL,                        \
-            (Data *)_datPtr, _size);                            \
+            (Data *)_datPtr,(Size) _size);                            \
       _datPtr = NULLP;                                          \
    }                                                            \
 }
index 131b7fb..9479dc3 100644 (file)
@@ -492,7 +492,7 @@ uint8_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf)
 {
    if(pst->selector == ODU_SELECTOR_LWLC)
    {
-      OduCellId *cellId;
+      OduCellId *cellId=NULLP;
       /* unpack the address of the structure */
       CMCHKUNPK(oduUnpackPointer, (PTR *)&cellId, mBuf);
       ODU_PUT_MSG_BUF(mBuf);
index ed44441..08394e7 100644 (file)
@@ -1272,8 +1272,7 @@ typedef struct macCellDeleteRsp
 {
    uint16_t cellId;
    CellDeleteStatus result;
-}
-MacCellDeleteRsp;
+}MacCellDeleteRsp;
 
 /* Functions for slot Ind from MAC to DU APP*/
 typedef uint8_t (*DuMacCellUpInd) ARGS((
index b3b6886..819063d 100644 (file)
@@ -7655,6 +7655,10 @@ uint8_t procGnbDuUpdate(F1AP_PDU_t *f1apMsg)
          return RFAILED;
       }
    }
+   else
+   {
+      memset(&f1apMsgDb, 0, sizeof(F1apMsgDb));
+   }
 
    return ROK;
 }
index 452e318..39874f6 100644 (file)
@@ -525,10 +525,11 @@ S16 processPolling(sctpSockPollParams *pollParams, CmInetFd *sockFd, uint32_t *t
  * ****************************************************************/
 S16 sctpSend(Buffer *mBuf)
 {
-   uint8_t          ret;
-   MsgLen           len;          /* number of actually sent octets */
+   uint8_t          ret = ROK;
+   MsgLen           len = 0;          /* number of actually sent octets */
    CmInetMemInfo    memInfo;                        
-   
+  
+   memset(&memInfo , 0, sizeof(CmInetMemInfo));
    memInfo.region = CU_APP_MEM_REG;               
    memInfo.pool   = CU_POOL;
 
index 167dbcd..6c4b888 100644 (file)
 
 #endif
 
+DuMacCellDeleteReq packMacCellDeleteReqOpts[] =
+{
+   packDuMacCellDeleteReq,       /* Loose coupling */
+   MacProcCellDeleteReq,         /* TIght coupling */
+   packDuMacCellDeleteReq        /* Light weight-loose coupling */
+};
+
 /*******************************************************************
  *
  * @brief Processes cells to be activated
@@ -195,6 +202,175 @@ uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId)
    return ROK;
 }
 
+/*******************************************************************
+ *
+ * @brief Handle Cell delete response from MAC
+ *
+ * @details
+ *
+ *    Function : DuProcMacCellDeleteRsp
+ *
+ *    Functionality: Handle Cell delete response from MAC
+ *
+ * @params[in] Pointer to MacCellDeleteRsp and Pst
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *deleteRsp)
+{
+   uint8_t ret = ROK;
+   uint16_t cellIdx=0;
+   if(deleteRsp)
+   {
+      if(deleteRsp->result == SUCCESSFUL_RSP)
+      {
+         GET_CELL_IDX(deleteRsp->cellId, cellIdx);
+         DU_LOG("\nINFO   -->  DU APP : MAC CELL Delete Response : SUCCESS [CELL IDX : %d]", deleteRsp->cellId);
+         if(duCb.actvCellLst[cellIdx]->cellId == deleteRsp->cellId)
+         {
+            memset(duCb.actvCellLst[cellIdx], 0, sizeof(DuCellCb));
+            gCellStatus = CELL_DOWN;
+
+#ifdef O1_ENABLE
+            DU_LOG("\nINFO   -->  DU APP : Raise cell down alarm for cell id=%d", deleteRsp->cellId);
+            raiseCellAlrm(CELL_DOWN_ALARM_ID, deleteRsp->cellId);
+            setCellOpState(deleteRsp->cellId, DISABLED, INACTIVE);
+#endif
+
+            duCb.numActvCells--;
+            duCb.numCfgCells--;
+            DU_FREE(duCb.actvCellLst[cellIdx], sizeof(DuCellCb));
+         }
+         else
+         {
+            DU_LOG("\nERROR  -->  DU APP : DuProcMacCellDeleteRsp(): CellId [%d] doesnot exist", deleteRsp->cellId);
+            ret = RFAILED;
+         }
+      }
+      else
+      {
+         DU_LOG("\nERROR  -->  DU APP : DuProcMacCellDeleteRsp(): MAC CELL Delete Response : FAILED\
+         [CELL IDX : %d]", deleteRsp->cellId);
+         ret = RFAILED;
+      }
+      DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacCellDeleteRsp));
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->  DU APP : DuProcMacCellDeleteRsp(): Received MAC cell delete response is NULL");
+      ret = RFAILED;
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief Sending Cell Delete Req To Mac
+ *
+ * @details
+ *
+ *    Function : sendCellDeleteReqToMac
+ *
+ *    Functionality:
+ *     sending Cell Delete Req To Mac
+ *
+ *  @params[in]    uint16_t cellId
+ *  @return ROK     - success
+ *          RFAILED - failure
+ *
+ *
+ *****************************************************************/
+
+uint8_t sendCellDeleteReqToMac(uint16_t cellId)
+{
+   Pst pst;
+   uint8_t ret=ROK;
+   MacCellDelete *cellDelete = NULLP;
+   
+   DU_ALLOC_SHRABL_BUF(cellDelete, sizeof(MacCellDelete));
+   if(cellDelete)
+   {
+      cellDelete->cellId = cellId;
+      FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_DELETE_REQ);
+
+      DU_LOG("\nINFO   -->  DU APP : Sending Cell Delete Request to MAC");  
+      /* Processing one Cell at a time to MAC */
+      ret = (*packMacCellDeleteReqOpts[pst.selector])(&pst, cellDelete);
+      if(ret == RFAILED)
+      {
+         DU_LOG("\nERROR  -->  DU APP : sendCellDeleteReqToMac(): Failed to send Cell delete Req to MAC");
+         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cellDelete, sizeof(MacCellDelete));
+      }
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->   DU APP : sendCellDeleteReqToMac(): Failed to allocate memory"); 
+      ret = RFAILED;
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief DU preocess Cell Delete Req to MAC 
+ *
+ * @details
+ *
+ *    Function : duSendCellDeletReq 
+ *
+ *    Functionality: DU process Cell Delete Req to MAC 
+ *
+ * @params[in] uint16_t cellId
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+
+uint8_t duSendCellDeletReq(uint16_t cellId)
+{
+   uint16_t cellIdx = 0;
+   DU_LOG("\nINFO   -->  DU APP : Processing Cell Delete Request ");
+   GET_CELL_IDX(cellId, cellIdx);
+
+   if(duCb.actvCellLst[cellIdx] == NULLP)
+   {
+      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): CellId[%d] is not found", cellId);
+      return RFAILED;
+   }
+   
+   if(duCb.actvCellLst[cellIdx]->cellId != cellId)
+   {
+      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): CellId[%d] is not found", cellId);
+      return RFAILED;
+
+   }  
+   
+   if(duCb.actvCellLst[cellIdx]->cellStatus != DELETION_IN_PROGRESS)
+   {
+      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): CellStatus[%d] of cellId[%d] is not correct.\
+      Expected CellStatus is DELETION_IN_PROGRESS",duCb.actvCellLst[cellIdx]->cellStatus, cellId);
+      return RFAILED;  
+   }
+
+   if(duCb.actvCellLst[cellIdx]->numActvUes)
+   {
+      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): Active UEs still present in cellId[%d].\
+      Failed to delete cell", cellId);
+      return RFAILED;
+   }
+
+   if(duBuildAndSendMacCellStop(cellId) == RFAILED)
+   {
+      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): Failed to build and send cell stop request to MAC for\
+            cellId[%d]",cellId);
+      return RFAILED;
+   }
+
+   return ROK;
+}
+
 /**********************************************************************
   End of file
  **********************************************************************/
index 31b432b..234a973 100644 (file)
@@ -7797,7 +7797,7 @@ void freeMacPdschServCellInfo(PdschServCellCfg *pdsch)
 {
    if(pdsch->xOverhead)
    {
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->xOverhead, sizeof(uint8_t));
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->xOverhead, sizeof(PdschXOverhead));
    }
    if(pdsch->codeBlkGrpFlushInd)
    {
@@ -7805,7 +7805,7 @@ void freeMacPdschServCellInfo(PdschServCellCfg *pdsch)
    }
    if(pdsch->maxCodeBlkGrpPerTb)
    {
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxCodeBlkGrpPerTb, sizeof(uint8_t));
+      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, pdsch->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
    }
    if(pdsch->maxMimoLayers)
    {
@@ -8210,7 +8210,7 @@ uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg,
         }
         else
         {
-            DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(uint8_t));
+            DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(MaxCodeBlkGrpPerTB));
             if(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)
            {
                *(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb)  = \
@@ -8229,7 +8229,7 @@ uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg,
         }
         else
         {
-            DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->maxCodeBlkGrpPerTb, sizeof(bool));
+            DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->codeBlkGrpFlushInd , sizeof(bool));
             if(macUePdschSrvCellCfg->codeBlkGrpFlushInd)
            {
                *(macUePdschSrvCellCfg->codeBlkGrpFlushInd)  = \
@@ -8278,7 +8278,7 @@ uint8_t extractPdschServingCellCfg(PDSCH_ServingCellConfig_t *cuPdschSrvCellCfg,
       }
       else
       {
-         DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->xOverhead, sizeof(uint8_t));
+         DU_ALLOC_SHRABL_BUF(macUePdschSrvCellCfg->xOverhead, sizeof(PdschXOverhead));
          if(macUePdschSrvCellCfg->xOverhead)
          {
             *(macUePdschSrvCellCfg->xOverhead)  = *(cuPdschSrvCellCfg->xOverhead);
@@ -11795,15 +11795,16 @@ void freeAperDecodeGnbDuAck(GNBDUConfigurationUpdateAcknowledge_t *gnbDuAck)
 
 uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
 {
-   uint8_t ueId =0 , ueIdx =0, ieIdx=0,arrIdx=0;
-   uint8_t cellId =0, cellIdx =0, crnti=0;
-   CmLList *f1apPduNode;
-   ReservedF1apPduInfo *f1apPduInfo;
+   uint8_t  ieIdx=0, arrIdx=0;
+   uint8_t  ueId =0 , ueIdx =0;
+   uint16_t cellId =0, cellIdx =0, crnti=0;
+   CmLList *f1apPduNode = NULLP;
+   ReservedF1apPduInfo *f1apPduInfo =NULLP;
    F1AP_PDU_t *f1apMsgPdu = NULLP;
    GNBDUConfigurationUpdate_t *gnbDuConfigUpdate = NULLP;
-   BIT_STRING_t *cellIdentity;
-   struct Served_Cells_To_Delete_ItemIEs *deleteItemIe;
-   Served_Cells_To_Delete_List_t *cellsToDelete;
+   BIT_STRING_t *cellIdentity=NULLP;
+   struct Served_Cells_To_Delete_ItemIEs *deleteItemIe=NULLP;
+   Served_Cells_To_Delete_List_t *cellsToDelete=NULLP;
    Served_Cells_To_Delete_Item_t *deleteItem=NULLP;
 
    DU_LOG("\nINFO   -->  DU APP: GNB-DU config update Ack received ");
@@ -11841,7 +11842,7 @@ uint8_t duProcGnbDuCfgUpdAckMsg(uint8_t transId)
                   GET_CELL_IDX(cellId, cellIdx);
                   if(duCb.actvCellLst[cellIdx] != NULLP)
                   {
-                     for(ueIdx = 0; ueIdx < duCb.numUe; ueIdx++)
+                     for(ueIdx = 0; ueIdx < duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++)
                      {
                         crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
                         GET_UE_IDX(crnti,ueId);
@@ -12647,7 +12648,7 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
             {
                for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++)
                {
-                  for(ueIdx = 0; ueIdx < duCb.numUe; ueIdx++)
+                  for(ueIdx = 0; ueIdx < duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++)
                   {
                      if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
                            (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
@@ -13164,7 +13165,7 @@ uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
                   {
                      for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++)
                      {
-                        for(ueIdx = 0; ueIdx < duCb.numUe; ueIdx++)
+                        for(ueIdx = 0; ueIdx < duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++)
                         {
                            if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
                                  (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
index 39265d6..0cd9f86 100644 (file)
@@ -68,7 +68,8 @@ typedef enum
 typedef enum
 {
    UE_INACTIVE,
-   UE_ACTIVE
+   UE_ACTIVE,
+   UE_DELETION_IN_PROGRESS
 }UeState;
 
 typedef enum
@@ -160,13 +161,14 @@ typedef struct duUeCb
 
 typedef struct duCellCb
 {
-   uint16_t       cellId;           /* Internal cell Id */
-   CellCfgParams  cellInfo;         /* Cell info */
+   uint16_t       cellId;                 /* Internal cell Id */
+   CellCfgParams  cellInfo;               /* Cell info */
    /* pointer to store the address of macCellCfg params used to send du-app to MAC */
-   MacCellCfg    *duMacCellCfg;
-   CellStatus     cellStatus;       /* Cell status */
-   uint32_t       numActvUes;       /* Total Active UEs */
-   DuUeCb         ueCb[MAX_NUM_UE];  /* UE CONTEXT */
+   MacCellCfg     *duMacCellCfg;
+   CellStatus     cellStatus;             /* Cell status */
+   uint32_t       gnbDuUeF1apIdGenerator; /* Generating Du Ue F1ap Id */
+   uint32_t       numActvUes;             /* Total Active UEs */
+   DuUeCb         ueCb[MAX_NUM_UE];       /* UE CONTEXT */
 }DuCellCb;
 
 typedef struct duLSapCb
@@ -200,20 +202,19 @@ typedef struct reservedF1apPduInfo
 /* DU APP DB */
 typedef struct duCb
 {
-   Mem           mem;    /* Memory configs */
-   TskInit       init;   /* DU Init */
-   //DuLSapCb      **macSap;  /* MAC SAP */
-   bool          f1Status; /* Status of F1 connection */
-   bool          e2Status; /* Status of E2 connection */
-   uint8_t       numCfgCells; 
-   DuCellCb*     cfgCellLst[MAX_NUM_CELL];     /* List of cells at DU APP of type DuCellCb */
-   uint8_t       numActvCells;
-   DuCellCb*     actvCellLst[MAX_NUM_CELL];    /* List of cells activated/to be activated of type DuCellCb */
-   uint32_t       numUe;            /* current number of UEs */
-   UeCcchCtxt     ueCcchCtxt[MAX_NUM_UE]; /* mapping of gnbDuUeF1apId to CRNTI required for CCCH processing*/
-   uint8_t       numDrb;           /* current number of DRbs*/
-   UpTnlCfg*     upTnlCfg[MAX_NUM_DRB]; /* tunnel info for every Drb */
-   CmLListCp     reservedF1apPduList; /*storing F1AP pdu infomation and transId */
+   Mem           mem;                       /* Memory configs */
+   TskInit       init;                      /* DU Init */
+   bool          f1Status;                  /* Status of F1 connection */
+   bool          e2Status;                  /* Status of E2 connection */
+   uint8_t       numCfgCells;               /* number of configured cells */ 
+   DuCellCb*     cfgCellLst[MAX_NUM_CELL];  /* List of cells at DU APP of type DuCellCb */
+   uint8_t       numActvCells;              /* Number of active cells */
+   DuCellCb*     actvCellLst[MAX_NUM_CELL]; /* List of cells activated/to be activated of type DuCellCb */
+   uint32_t      numUe;                     /* current number of UEs */
+   UeCcchCtxt    ueCcchCtxt[MAX_NUM_UE];    /* mapping of gnbDuUeF1apId to CRNTI required for CCCH processing*/
+   uint8_t       numDrb;                    /* current number of DRbs*/
+   UpTnlCfg*     upTnlCfg[MAX_NUM_DRB];     /* tunnel info for every Drb */
+   CmLListCp     reservedF1apPduList;       /*storing F1AP pdu infomation and transId */
 }DuCb;
 
 
index 85579c5..fd1fe65 100644 (file)
@@ -62,6 +62,7 @@ uint8_t egtpHdlDatInd(EgtpMsg egtpMsg);
 uint8_t BuildAndSendDUConfigUpdate();
 uint16_t getTransId();
 uint8_t cmPkLrgSchCfgReq(Pst * pst,RgMngmt * cfg);
+uint8_t sendCellDeleteReqToMac(uint16_t cellId);
 
 packMacCellCfgReq packMacCellCfgOpts[] =
 {
@@ -329,7 +330,7 @@ uint8_t duBuildRlcUsapCfg(uint8_t elemId, Ent ent, Inst inst)
 uint8_t duProcCfgComplete()
 {
    uint8_t         ret = ROK;
-   static uint16_t cellId = 0;
+   uint16_t        cellId = 0;
    uint16_t        idx;
    for(idx=0; idx< DEFAULT_CELLS; idx++)
    {
@@ -351,7 +352,7 @@ uint8_t duProcCfgComplete()
          cell->cellInfo.nrEcgi.plmn.mcc[2] = PLMN_MCC2;
          cell->cellInfo.nrEcgi.plmn.mnc[0] = PLMN_MNC0;
          cell->cellInfo.nrEcgi.plmn.mnc[1] = PLMN_MNC1;
-         cell->cellInfo.nrEcgi.cellId = NR_CELL_ID;
+         cell->cellInfo.nrEcgi.cellId = cell->cellId;
          cell->cellInfo.nrPci = NR_PCI; 
          cell->cellInfo.fiveGsTac = DU_TAC;
          memset(&cell->cellInfo.plmn[idx1], 0, sizeof(Plmn));
@@ -366,7 +367,7 @@ uint8_t duProcCfgComplete()
          cell->cellInfo.maxUe = duCfgParam.maxUe;
          cell->cellStatus = CELL_OUT_OF_SERVICE;
          gCellStatus = CELL_DOWN;
-
+         cell->gnbDuUeF1apIdGenerator = 0;
          duCb.cfgCellLst[duCb.numCfgCells] = cell;
          duCb.numCfgCells++;
       }
@@ -1577,7 +1578,7 @@ uint8_t duBuildAndSendMacCellStop(uint16_t cellId)
          DU_LOG("\nERROR  -->  DU APP : duBuildAndSendMacCellStop():  Memory allocation failed ");
          return RFAILED;
       }
-
+      memset(oduCellId, 0, sizeof(OduCellId));
       oduCellId->cellId = duCb.actvCellLst[cellIdx]->cellId;
 
       /* Fill Pst */
@@ -1621,10 +1622,16 @@ uint8_t duHandleStopInd(Pst *pst, OduCellId *cellId)
    if(duGetCellCb(cellId->cellId, &cellCb) != ROK)
       return RFAILED;
 
-   if((cellCb->cellStatus == ACTIVATED))
+   if((cellCb->cellStatus == ACTIVATED) || (cellCb->cellStatus == DELETION_IN_PROGRESS))
    {
       DU_LOG("\nINFO   -->  DU APP : 5G-NR Cell %d is DOWN", cellId->cellId);
-      cellCb->cellStatus = DELETION_IN_PROGRESS;
+      if(sendCellDeleteReqToMac(cellId->cellId) == RFAILED)
+      {
+         DU_LOG("\nERROR  -->  DU APP : duHandleStopInd(): Failed to send Cell delete req to MAC for\
+               cellId[%d]", cellId->cellId);
+         return RFAILED;
+      }
+
 
 #ifdef O1_ENABLE
       DU_LOG("\nINFO   -->  DU APP : Raise cell down alarm for cell id=%d", cellId->cellId);
index a1ba406..92734a5 100644 (file)
@@ -55,7 +55,10 @@ uint8_t sctpActvInit(Ent entity, Inst inst, Region region, Reason reason)
    DU_LOG("\n\nDEBUG  -->  SCTP : Initializing");
    ODU_SET_PROC_ID(DU_PROC);
    connUp = FALSE;
+   
+   memset(&f1Params, 0, sizeof(DuSctpDestCb));
    f1Params.assocId = -1;
+   memset(&ricParams, 0, sizeof(DuSctpDestCb));
    ricParams.assocId = -1;
    nonblocking = FALSE;
    return ROK;
index b6c333b..7780439 100644 (file)
 #include "du_f1ap_msg_hdl.h"
 #include "du_ue_mgr.h"
 
+#ifdef O1_ENABLE
+#include "AlarmInterface.h"
+#include "ConfigInterface.h"
+#endif
+
 DuMacDlCcchInd packMacDlCcchIndOpts[] =
 {
    packMacDlCcchInd,           /* Loose coupling */
@@ -97,13 +102,6 @@ DuRlcUeDeleteReq packRlcUeDeleteReqOpts[] =
    packDuRlcUeDeleteReq        /* Light weight-loose coupling */
 };
 
-DuMacCellDeleteReq packMacCellDeleteReqOpts[] =
-{
-   packDuMacCellDeleteReq,       /* Loose coupling */
-   MacProcCellDeleteReq,         /* TIght coupling */
-   packDuMacCellDeleteReq        /* Light weight-loose coupling */
-};
-
 /*******************************************************************
  *
  * @brief Function to fillDlUserDataInfo
@@ -479,11 +477,20 @@ uint8_t duProcDlRrcMsg(F1DlRrcMsg *dlRrcMsg)
  * @return gnbDuF1apId
  *
  * ****************************************************************/
-uint32_t genGnbDuUeF1apId()
-{
-   static uint32_t gnbDuUeF1apId = 0;
-
-   return ++gnbDuUeF1apId;
+int32_t genGnbDuUeF1apId(uint8_t cellId)
+{
+    uint8_t cellIdx =0;
+
+    GET_CELL_IDX(cellId, cellIdx);
+    if(duCb.actvCellLst[cellIdx])
+    {
+       return  ++duCb.actvCellLst[cellIdx]->gnbDuUeF1apIdGenerator;
+    }
+    else
+    {
+       DU_LOG("ERROR  --> DU_APP : genGnbDuUeF1apId(): CellId[%d] does not exist", cellId);
+    }
+    return -1;
 }
 
 /******************************************************************
@@ -505,12 +512,18 @@ uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo)
 {
 
    uint8_t ret = ROK;
-   uint32_t gnbDuUeF1apId = 0;
+   int32_t gnbDuUeF1apId = 0;
 
-   gnbDuUeF1apId = genGnbDuUeF1apId();
+   gnbDuUeF1apId = genGnbDuUeF1apId(ulCcchIndInfo->cellId);
+   
+   if(gnbDuUeF1apId == -1)
+   {
+      DU_LOG("ERROR  --> DU_APP : duProcUlCcchInd(): Received cellId[%d] does not exist", ulCcchIndInfo->cellId);
+      return RFAILED;
+   }
 
    /* Store Ue mapping */
-   duCb.ueCcchCtxt[duCb.numUe].gnbDuUeF1apId = gnbDuUeF1apId;
+   duCb.ueCcchCtxt[duCb.numUe].gnbDuUeF1apId = (uint32_t)gnbDuUeF1apId;
    duCb.ueCcchCtxt[duCb.numUe].crnti         = ulCcchIndInfo->crnti;
    duCb.ueCcchCtxt[duCb.numUe].cellId        = ulCcchIndInfo->cellId;
 
@@ -945,7 +958,7 @@ uint8_t fillMacLcCfgToAddMod(LcCfg *lcCfg, LcCfg *ueSetReqDb)
       {
          DU_ALLOC_SHRABL_BUF(lcCfg->drbQos, sizeof(DrbQosInfo));
          if(!lcCfg->drbQos)
-         {
+         { 
             DU_LOG("\nERROR  -->  DU APP : Memory Alloc failed at drQos at fillMacLcCfgToAddMod()");
             return RFAILED;
          }
@@ -1615,6 +1628,7 @@ uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId)
 
         duCb.actvCellLst[cellIdx]->numActvUes++;
         memset(ueCcchCtxt, 0, sizeof(UeCcchCtxt));
+    duCb.numUe--;
       }
    }
    return ret;
@@ -2022,19 +2036,18 @@ uint8_t duProcEgtpTunnelCfg(uint8_t ueCbIdx, UpTnlCfg *duTnlCfg, UpTnlCfg *f1Tnl
    {
       if(duSendEgtpTnlMgmtReq(EGTP_TNL_MGMT_DEL, duTnlCfg->tnlCfg1->teId, f1TnlCfg->tnlCfg1) == ROK)
       {           
-        /* Free memory at drbIdx */
-        DU_FREE(duTnlCfg->tnlCfg1, sizeof(GtpTnlCfg));
-        DU_FREE(duTnlCfg, sizeof(UpTnlCfg));
-        duCb.numDrb--;
-        for(delIdx = ueCbIdx; delIdx < duCb.numDrb; delIdx++)
-        {
-           /* moving all elements one index ahead */
-           ret = fillTnlCfgToAddMod(&duCb.upTnlCfg[delIdx], duCb.upTnlCfg[delIdx+1]);
-           if(ret != ROK)
-           {
-              return ret;
-           }
-        }
+         /* Free memory at drbIdx */
+         DU_FREE(duTnlCfg->tnlCfg1, sizeof(GtpTnlCfg));
+         duCb.numDrb--;
+         for(delIdx = ueCbIdx; delIdx < duCb.numDrb; delIdx++)
+         {
+            /* moving all elements one index ahead */
+            ret = fillTnlCfgToAddMod(&duCb.upTnlCfg[delIdx], duCb.upTnlCfg[delIdx+1]);
+            if(ret != ROK)
+            {
+               return ret;
+            }
+         }
       }   
    }
    return ret;
@@ -2152,7 +2165,7 @@ uint8_t duUpdateDuUeCbCfg(uint8_t ueIdx, uint8_t cellId)
            if(duUpdateTunnelCfgDb(ueIdx, cellId, &ueCb->f1UeDb->duUeCfg) != ROK)
            {
                DU_LOG("\nERROR  -->  DU_APP : Failed to establish tunnel in duUpdateDuUeCbCfg()");
-              return RFAILED;
+                   return RFAILED;
            }
         }
       }
@@ -2502,20 +2515,21 @@ uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg)
             if(ret == RFAILED)
                DU_LOG("\nERROR  -->  DU APP : Failed to process UE Context Setup Request in DuProcRlcDlRrcMsgRsp()");
          }
+         
          if(ueCb->f1UeDb->actionType == UE_CTXT_MOD)
          {
             ret = duBuildAndSendUeContextModReq(dlRrcMsg->cellId, dlRrcMsg->crnti, &ueCb->f1UeDb->duUeCfg);
             if(ret == RFAILED)
                DU_LOG("\nERROR  -->  DU APP : Failed to process UE Context Mod Request in DuProcRlcDlRrcMsgRsp()");
          }
-         if(ueCb->f1UeDb->actionType == UE_CTXT_RELEASE)
+
+         if(ueCb->f1UeDb->actionType == UE_CTXT_RELEASE && ueCb->ueState == UE_ACTIVE)
          {
             ret = duBuildAndSendUeDeleteReq(dlRrcMsg->cellId,dlRrcMsg->crnti);
             if(ret == RFAILED)
             {
                DU_LOG("\nERROR  -->  DU APP : Failed to process UE Context Release Request in DuProcRlcDlRrcMsgRsp()");
             }
-
          }
       }
    }
@@ -2717,88 +2731,16 @@ void deletePdschServCellCfg(PdschServCellCfg *pdschServCellCfg)
 
 void deleteMacUeCfg(MacUeCfg *ueCfg)
 {
-   uint8_t lcCfgIdx;
-   uint8_t resrcIdx;
-   ServCellCfgInfo *servCellCfg;
-   PucchResrcInfo *resrcToAddModList;
-
-   if(ueCfg)
+   uint8_t lcCfgIdx=0;
+   
+   DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,ueCfg->ambrCfg, sizeof(AmbrCfg));
+   if(ueCfg->spCellCfgPres)
    {
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,ueCfg->ambrCfg, sizeof(AmbrCfg));
-      if(ueCfg->spCellCfgPres)
-      {
-         servCellCfg = &ueCfg->spCellCfg.servCellCfg;
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->bwpInactivityTmr, sizeof(uint8_t));
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.resrcSet,\
-         sizeof(PucchResrcSetCfg));
-         if(servCellCfg->initUlBwp.pucchCfg.resrc)
-         {
-            /*freeing the PucchResrcCfg*/
-            for(resrcIdx= 0; resrcIdx< servCellCfg->initUlBwp.pucchCfg.resrc->resrcToAddModListCount; resrcIdx++)
-            {
-               resrcToAddModList=&servCellCfg->initUlBwp.pucchCfg.resrc->resrcToAddModList[resrcIdx];
-               switch(resrcToAddModList->pucchFormat)
-               {
-                  case PUCCH_FORMAT_0:
-                     {
-                        DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format0 ,\
-                        sizeof(PucchFormat0));
-                        break;
-                     }
-                  case PUCCH_FORMAT_1:
-                     {
-                        DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format1 ,\
-                        sizeof(PucchFormat1));
-                        break;
-                     }
-                  case PUCCH_FORMAT_2:
-                     {
-                        DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format2 ,\
-                        sizeof(PucchFormat2_3));
-                        break;
-                     }
-                  case PUCCH_FORMAT_3:
-                     {
-                        DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format3 ,\
-                        sizeof(PucchFormat2_3));
-                        break;
-                     }
-                  case PUCCH_FORMAT_4:
-                     {
-                        DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,resrcToAddModList->PucchFormat.format4 ,\
-                        sizeof(PucchFormat4));
-                        break;
-                     }
-               }
-            }
-            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.resrc,\
-            sizeof(PucchResrcCfg));
-         }
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.format1,\
-         sizeof(PucchFormatCfg));
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.format2,\
-         sizeof(PucchFormatCfg));
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.format3,\
-         sizeof(PucchFormatCfg));
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.format4,\
-         sizeof(PucchFormatCfg));
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.schedReq,\
-         sizeof(PucchSchedReqCfg));
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.multiCsiCfg,\
-         sizeof(PucchMultiCsiCfg));
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.spatialInfo,\
-         sizeof(PucchSpatialCfg));
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.dlDataToUlAck ,\
-         sizeof(PucchDlDataToUlAck));
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,servCellCfg->initUlBwp.pucchCfg.powerControl,\
-         sizeof(PucchPowerControl));
-         deletePdschServCellCfg(&servCellCfg->pdschServCellCfg);
-      }
-      for(lcCfgIdx=0; lcCfgIdx< ueCfg->numLcs; lcCfgIdx++)
-      {
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,ueCfg->lcCfgList[lcCfgIdx].drbQos, sizeof(DrbQosInfo));
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,ueCfg->lcCfgList[lcCfgIdx].snssai, sizeof(Snssai));
-      }
+      freeUeReCfgCellGrpInfo(ueCfg);
+   }
+   for(lcCfgIdx=0; lcCfgIdx< ueCfg->numLcs; lcCfgIdx++)
+   {
+      freeMacLcCfg(&ueCfg->lcCfgList[lcCfgIdx]);
    }
    memset(ueCfg, 0, sizeof(MacUeCfg));
 }
@@ -2820,7 +2762,9 @@ void deleteMacUeCfg(MacUeCfg *ueCfg)
 * ****************************************************************/
 uint8_t  deleteUeCfg(uint16_t cellIdx, uint8_t ueIdx)
 {
+   uint8_t tnlIdx = 0;
    DuUeCb *ueCb = NULLP;
+   
    if(duCb.actvCellLst[cellIdx] != NULLP)
    {
       if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].macUeCfg.macUeCfgState == UE_DELETE_COMPLETE)\
@@ -2833,6 +2777,16 @@ uint8_t  deleteUeCfg(uint16_t cellIdx, uint8_t ueIdx)
          {
             freeF1UeDb(ueCb->f1UeDb);
          }
+         for(tnlIdx = 0; tnlIdx < duCb.numDrb; )
+         {
+            if(duCb.upTnlCfg[tnlIdx]->ueIdx == ueIdx)
+            {
+               duCb.upTnlCfg[tnlIdx]->configType = CONFIG_DEL;
+               duProcEgtpTunnelCfg(tnlIdx, duCb.upTnlCfg[tnlIdx], duCb.upTnlCfg[tnlIdx]);
+            }
+            else
+               tnlIdx++;
+         }
          duCb.actvCellLst[cellIdx]->numActvUes--;
          memset(ueCb, 0, sizeof(DuUeCb));
       }
@@ -2868,9 +2822,10 @@ uint8_t  deleteUeCfg(uint16_t cellIdx, uint8_t ueIdx)
 
 uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp)
 {
-   uint8_t  ret =ROK;
+   uint8_t  ret =ROK,ueId=0;
    uint16_t cellIdx=0;
-
+   uint32_t gnbCuUeF1apId =0 , gnbDuUeF1apId =0;
+   
    if(deleteRsp)
    {
       if(deleteRsp->result == SUCCESS)
@@ -2880,11 +2835,18 @@ uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp)
          if(duCb.actvCellLst[cellIdx])
          {
             duCb.actvCellLst[cellIdx]->ueCb[deleteRsp->ueId -1].macUeCfg.macUeCfgState = UE_DELETE_COMPLETE;
-            if(sendUeDeleteReqToRlc(deleteRsp->cellId, deleteRsp->ueId) == RFAILED)
+            ueId = deleteRsp->ueId;
+            gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
+            gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
+            if(deleteUeCfg(cellIdx, ueId) == ROK)
             {
-               DU_LOG("\nERROR  -->  DU APP : DuProcMacUeDeleteRsp():Failed to build UE  delete req for RLC ");
-               ret = RFAILED;
+               ret = BuildAndSendUeContextReleaseComplete(deleteRsp->cellId, gnbCuUeF1apId, gnbDuUeF1apId);
+               if(ret != ROK)
+               {
+                  DU_LOG("\nERROR  -->  DU APP : DuProcMacUeDeleteRsp(): failed to send UE context release complete");
+               }
             }
+
          }
       }
       else
@@ -2924,8 +2886,7 @@ uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp)
 uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp)
 {
    uint8_t  ueId = 0, ret = ROK;
-   uint16_t cellIdx = 0;
-   uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId =0;   
+   uint16_t cellIdx = 0,crnti=0;
 
    if(delRsp)
    {
@@ -2938,16 +2899,13 @@ uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp)
          if(duCb.actvCellLst[cellIdx]!=NULLP)
          {
             duCb.actvCellLst[cellIdx]->ueCb[ueId-1].rlcUeCfg.rlcUeCfgState = UE_DELETE_COMPLETE;
-            gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
-            gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
-            if(deleteUeCfg(cellIdx, ueId) == ROK)
+            GET_CRNTI(crnti, ueId);
+            if(sendUeDeleteReqToMac(delRsp->cellId, ueId, crnti) == RFAILED)
             {
-               ret = BuildAndSendUeContextReleaseComplete(delRsp->cellId, gnbCuUeF1apId, gnbDuUeF1apId);
-               if(ret != ROK)
-               {
-                  DU_LOG("\nERROR  -->  DU APP : DuProcMacUeDeleteRsp(): failed to send UE context release complete");
-               }
+               DU_LOG("\nERROR  -->  DU APP : duBuildAndSendUeDeleteReq(): Failed to build UE  delete req for MAC ");
+               return RFAILED;
             }
+
          }
       }
       else
@@ -3087,9 +3045,10 @@ uint8_t duBuildAndSendUeDeleteReq(uint16_t cellId, uint16_t crnti)
          return RFAILED;
       }
 
-      if(sendUeDeleteReqToMac(cellId, ueId, crnti) == RFAILED)
+      duCb.actvCellLst[cellIdx]->ueCb[ueId - 1].ueState = UE_DELETION_IN_PROGRESS; 
+      if(sendUeDeleteReqToRlc(cellId, ueId) == RFAILED)
       {
-         DU_LOG("\nERROR  -->  DU APP : duBuildAndSendUeDeleteReq(): Failed to build UE  delete req for MAC ");
+         DU_LOG("\nERROR  -->  DU APP : DuProcMacUeDeleteRsp():Failed to build UE  delete req for RLC ");
          return RFAILED;
       }
    }
@@ -3157,210 +3116,6 @@ void deleteRlcUeCfg(RlcUeCfg *ueCfg)
    }
 }
 
-/*******************************************************************
- *
- * @brief Delete DU CellCb information 
- *
- * @details
- *
- *    Function : deleteDuCellCb
- *
- *    Functionality: Delete DU CellCb information
- *
- * @params[in] DuCellCb *cellCb
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-
-void deleteDuCellCb(DuCellCb *cellCb)
-{
-
-   if(cellCb->duMacCellCfg)
-   {
-      if(cellCb->duMacCellCfg->prachCfg.fdm[0].unsuedRootSeq)
-      {
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cellCb->duMacCellCfg->prachCfg.fdm[0].unsuedRootSeq,\
-               cellCb->duMacCellCfg->prachCfg.fdm[0].numUnusedRootSeq);
-      }
-      if(cellCb->duMacCellCfg->sib1Cfg.sib1Pdu)
-      {
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL,cellCb->duMacCellCfg->sib1Cfg.sib1Pdu,\
-               cellCb->duMacCellCfg->sib1Cfg.sib1PduLen);
-      }
-      DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cellCb->duMacCellCfg, sizeof(MacCellCfg));
-   }
-   memset(cellCb, 0, sizeof(DuCellCb));
-
-}
-
-/*******************************************************************
- *
- * @brief Handle Cell delete response from MAC
- *
- * @details
- *
- *    Function : DuProcMacCellDeleteRsp
- *
- *    Functionality: Handle Cell delete response from MAC
- *
- * @params[in] Pointer to MacCellDeleteRsp and Pst
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-
-uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *deleteRsp)
-{
-   uint8_t ret = ROK;
-   uint16_t cellIdx=0;
-   if(deleteRsp)
-   {
-      if(deleteRsp->result == SUCCESSFUL_RSP)
-      {
-         GET_CELL_IDX(deleteRsp->cellId, cellIdx);
-         DU_LOG("\nINFO   -->  DU APP : MAC CELL Delete Response : SUCCESS [CELL IDX : %d]", deleteRsp->cellId);
-         if(duCb.actvCellLst[cellIdx]->cellId == deleteRsp->cellId)
-         {
-            deleteDuCellCb(duCb.actvCellLst[cellIdx]);
-            gCellStatus = CELL_DOWN;
-            duCb.numActvCells--;
-            DU_FREE(duCb.actvCellLst[cellIdx], sizeof(DuCellCb));
-         }
-         else
-         {
-            DU_LOG("\nERROR  -->  DU APP : DuProcMacCellDeleteRsp(): CellId [%d] doesnot exist", deleteRsp->cellId);
-            ret = RFAILED;
-         }
-      }
-      else
-      {
-         DU_LOG("\nERROR  -->  DU APP : DuProcMacCellDeleteRsp(): MAC CELL Delete Response : FAILED\
-         [CELL IDX : %d]", deleteRsp->cellId);
-         ret = RFAILED;
-      }
-      DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacCellDeleteRsp));
-   }
-   else
-   {
-      DU_LOG("\nERROR  -->  DU APP : DuProcMacCellDeleteRsp(): Received MAC cell delete response is NULL");
-      ret = RFAILED;
-   }
-   return ret;
-}
-
-/*******************************************************************
- *
- * @brief Sending Cell Delete Req To Mac
- *
- * @details
- *
- *    Function : sendCellDeleteReqToMac
- *
- *    Functionality:
- *     sending Cell Delete Req To Mac
- *
- *  @params[in]    uint16_t cellId
- *  @return ROK     - success
- *          RFAILED - failure
- *
- *
- *****************************************************************/
-
-uint8_t sendCellDeleteReqToMac(uint16_t cellId)
-{
-   Pst pst;
-   uint8_t ret=ROK;
-   MacCellDelete *cellDelete = NULLP;
-   
-   DU_ALLOC(cellDelete, sizeof(MacCellDelete));
-   if(cellDelete)
-   {
-      cellDelete->cellId = cellId;
-      FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_DELETE_REQ);
-
-      DU_LOG("\nINFO   -->  DU APP : Sending Cell Delete Request to MAC");  
-      /* Processing one Cell at a time to MAC */
-      ret = (*packMacCellDeleteReqOpts[pst.selector])(&pst, cellDelete);
-      if(ret == RFAILED)
-      {
-         DU_LOG("\nERROR  -->  DU APP : sendCellDeleteReqToMac(): Failed to send Cell delete Req to MAC");
-         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cellDelete, sizeof(MacCellDelete));
-      }
-   }
-   else
-   {
-      DU_LOG("\nERROR  -->   DU APP : sendCellDeleteReqToMac(): Failed to allocate memory"); 
-      ret = RFAILED;
-   }
-   return ret;
-}
-
-/*******************************************************************
- *
- * @brief DU preocess Cell Delete Req to MAC 
- *
- * @details
- *
- *    Function : duSendCellDeletReq 
- *
- *    Functionality: DU process Cell Delete Req to MAC 
- *
- * @params[in] uint16_t cellId
- * @return ROK     - success
- *         RFAILED - failure
- *
- * ****************************************************************/
-
-uint8_t duSendCellDeletReq(uint16_t cellId)
-{
-   uint16_t cellIdx = 0;
-   DU_LOG("\nINFO   -->  DU APP : Processing Cell Delete Request ");
-   GET_CELL_IDX(cellId, cellIdx);
-
-   if(duCb.actvCellLst[cellIdx] == NULLP)
-   {
-      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): CellId[%d] is not found", cellId);
-      return RFAILED;
-   }
-   
-   if(duCb.actvCellLst[cellIdx]->cellId != cellId)
-   {
-      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): CellId[%d] is not found", cellId);
-      return RFAILED;
-
-   }  
-   
-   if(duCb.actvCellLst[cellIdx]->cellStatus != DELETION_IN_PROGRESS)
-   {
-      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): CellStatus[%d] of cellId[%d] is not correct.\
-      Expected CellStatus is DELETION_IN_PROGRESS",duCb.actvCellLst[cellIdx]->cellStatus, cellId);
-      return RFAILED;  
-   }
-
-   if(duCb.actvCellLst[cellIdx]->numActvUes)
-   {
-      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): Active UEs still present in cellId[%d].\
-      Failed to delete cell", cellId);
-      return RFAILED;
-   }
-
-   if(duBuildAndSendMacCellStop(cellId) == RFAILED)
-   {
-      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): Failed to build and send cell stop request to MAC for\
-            cellId[%d]",cellId);
-      return RFAILED;
-   }
-
-   if(sendCellDeleteReqToMac(cellId) == RFAILED)
-   {
-      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): Failed to send Cell delete req to MAC for\
-            cellId[%d]",cellId);
-      return RFAILED;
-   }
-
-   return ROK;
-}
 /*******************************************************************
 *
 * @brief Du process Ue Context Release Command
@@ -3417,6 +3172,7 @@ uint8_t duProcUeContextReleaseCommand(DuUeCb *duUeCb)
          DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand(): Failed to build and send Ue Delete request");
       }
    }
+
    return ret;
 }
 
index 56b85be..ebe33a3 100644 (file)
@@ -1134,6 +1134,19 @@ S16 l1HdlStopReq(uint32_t msgLen, void *msg)
    if(lwrMacCb.phyState == PHY_STATE_RUNNING)
    {
       l1HdlSlotIndicaion(TRUE);
+
+      /* Initialize all global variables */
+      sfnValue = 0;
+      slotValue = 0;
+      rachIndSent = false;
+      msg3Sent = false;
+      msg5ShortBsrSent = false;
+      msg5Sent = false;
+      dlDedMsg = false;
+      msgSecurityModeComp =  false;
+      msgRrcReconfiguration  =  false;
+      msgRegistrationComp    = false;
+
       DU_LOG("\nINFO   -->  PHY_STUB: Slot Indication is stopped successfully");
       MAC_FREE(msg, msgLen);
    }
index 29a4b01..f7912f7 100644 (file)
@@ -29,6 +29,7 @@
 uint8_t l1SendUlUserData();
 uint8_t l1SendStatusPdu();
 uint16_t l1BuildAndSendSlotIndication();
+uint16_t l1BuildAndSendStopInd();
 pthread_t thread = 0;
 
 /*******************************************************************
@@ -105,7 +106,6 @@ void GenerateTicks()
 void l1HdlSlotIndicaion(bool stopSlotInd)
 {
    Pst pst;
-   int ret;
    Buffer *mBuf = NULLP;
 
    if(!stopSlotInd)