[Epic-ID: ODUHIGH-464][Task-ID: ODUHIGH-478] WG8 Alignment | The First
[o-du/l2.git] / src / du_app / du_cell_mgr.c
index 926dc7c..e6519c7 100644 (file)
@@ -192,7 +192,7 @@ uint8_t duGetCellCb(uint16_t cellId, DuCellCb **cellCb)
 * 
 *  @params[in] DuCellCb *cellCb
 *
-*  @return void 
+*  @return ROK/RFAILURE (uint8_t return)
 * 
 * 
 ******************************************************************************/
@@ -212,7 +212,7 @@ uint8_t checkPagingRecord(DuCellCb *cellCb)
       /*No Page is present for pf thus exiting*/
       return ROK;
    }
-
+  
    do
    {
       pagInfo = handlePageInfoLL(pf, NULLD, &(pagInfoLLFromPF->pagInfoList), TRAVERSE_ALL);
@@ -225,9 +225,14 @@ uint8_t checkPagingRecord(DuCellCb *cellCb)
          }
          handlePageInfoLL(pf, pagInfo->i_s, &(pagInfoLLFromPF->pagInfoList), DELETE);
       }
+      if(pagInfoLLFromPF->pagInfoList.first == NULLP)
+      {
+         break;
+      }
    }while(pagInfo != NULLP);
    
    cmHashListDelete(&(cellCb->pagingInfoMap), (PTR)pagInfoLLFromPF);
+   DU_FREE(pagInfoLLFromPF, sizeof(DuPagInfoList));
    return ROK;
 }
 
@@ -241,13 +246,13 @@ uint8_t checkPagingRecord(DuCellCb *cellCb)
  *
  *    Functionality: Send pcch indication to MAC
  *
- * @Params[in] MacPcchInd *pcchInd
+ * @Params[in] DlPcchInd *pcchInd
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
 
-uint8_t sendDlPcchIndToMac(MacPcchInd *pcchInd)
+uint8_t sendDlPcchIndToMac(DlPcchInd *pcchInd)
 {
    uint8_t ret = ROK;
    Pst pst;
@@ -257,7 +262,6 @@ uint8_t sendDlPcchIndToMac(MacPcchInd *pcchInd)
       /* Fill Pst */
       FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_DL_PCCH_IND);
       
-      DU_LOG("\nDEBUG   -->  DU_APP: Sending DL PCCH indication to MAC for cellId[%d]", pcchInd->cellId);
       ret = (*packMacDlPcchIndOpts[pst.selector])(&pst, pcchInd);
       if(ret == RFAILED)
       {
@@ -266,7 +270,7 @@ uint8_t sendDlPcchIndToMac(MacPcchInd *pcchInd)
    }
    else
    {
-      DU_LOG("\nERROR  -->  DU_APP: sendDlPcchIndToMac(): Received pcchInd is NULLP");
+      DU_LOG("\nERROR  -->  DU APP: sendDlPcchIndToMac(): Received pcchInd is NULLP");
       ret = RFAILED;
    }
    return ret;
@@ -390,8 +394,9 @@ uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId)
 uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *deleteRsp)
 {
    uint8_t ret = ROK;
-   uint16_t cellIdx=0;
-   
+   uint16_t cellIdx=0, pfIdx=0;
+   DuPagInfoList *pagInfoLLFromPF=NULLP;
+
    if(deleteRsp)
    {
       if(deleteRsp->result == SUCCESSFUL_RSP)
@@ -400,6 +405,16 @@ uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *deleteRsp)
          DU_LOG("\nINFO   -->  DU APP : MAC CELL Delete Response : SUCCESS [CELL IDX : %d]", deleteRsp->cellId);
          if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->cellId == deleteRsp->cellId))
          {
+            for(pfIdx =0; pfIdx < MAX_SFN; pfIdx++)
+            {
+               pagInfoLLFromPF = findPagingInfoFromMap(pfIdx, &(duCb.actvCellLst[cellIdx]->pagingInfoMap));
+               if(pagInfoLLFromPF)
+               {   
+                  cmHashListDelete(&(duCb.actvCellLst[cellIdx]->pagingInfoMap), (PTR)pagInfoLLFromPF);
+                  DU_FREE(pagInfoLLFromPF, sizeof(DuPagInfoList));
+               }
+            }
+
             memset(duCb.actvCellLst[cellIdx], 0, sizeof(DuCellCb));
             gCellStatus = CELL_DOWN;
 
@@ -458,9 +473,9 @@ uint8_t sendCellDeleteReqToMac(uint16_t cellId)
 {
    Pst pst;
    uint8_t ret=ROK;
-   MacCellDelete *cellDelete = NULLP;
+   MacCellDeleteReq *cellDelete = NULLP;
    
-   DU_ALLOC_SHRABL_BUF(cellDelete, sizeof(MacCellDelete));
+   DU_ALLOC_SHRABL_BUF(cellDelete, sizeof(MacCellDeleteReq));
    if(cellDelete)
    {
       cellDelete->cellId = cellId;
@@ -472,7 +487,7 @@ uint8_t sendCellDeleteReqToMac(uint16_t cellId)
       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));
+         DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cellDelete, sizeof(MacCellDeleteReq));
       }
    }
    else
@@ -563,7 +578,7 @@ void freePcchPdu(PCCH_Message_t *pcchMsg)
          {
             if(pagingMsg->pagingRecordList)
             {
-               if(pagingMsg->pagingRecordList->list.array == NULLP)
+               if(pagingMsg->pagingRecordList->list.array != NULLP)
                {
                   for(recordIdx = 0; recordIdx <  pagingMsg->pagingRecordList->list.count; recordIdx++)
                   {
@@ -609,7 +624,7 @@ uint8_t BuildAndSendDlPcchIndToMac(uint16_t cellId, uint16_t pf, uint8_t i_s, Cm
    PCCH_Message_t *pcchMsg = NULLP;
    asn_enc_rval_t encRetVal;
    PagingRrc_t    *pagingMsg = NULLP;
-   MacPcchInd     *macPcchInd = NULLP;
+   DlPcchInd     *macPcchInd = NULLP;
    uint8_t        recordIdx = 0, ret = RFAILED;
    
    /*As per 38.473 Sec 9.3.1.39,5G-S-TMSI :48 Bits >>  Bytes and 0 UnusedBits */
@@ -727,7 +742,7 @@ uint8_t BuildAndSendDlPcchIndToMac(uint16_t cellId, uint16_t pf, uint8_t i_s, Cm
       {
          DU_LOG("\nDEBUG  -->  F1AP : Created APER encoded buffer for RRC PDU for Pcch indication \n");
          
-         DU_ALLOC_SHRABL_BUF(macPcchInd, sizeof(MacPcchInd));
+         DU_ALLOC_SHRABL_BUF(macPcchInd, sizeof(DlPcchInd));
          if(macPcchInd == NULLP)
          {
             DU_LOG("\nERROR  -->  DU APP: BuildAndSendDlPcchIndToMac(); (macPcchInd) Memory Alloction failed!");
@@ -749,7 +764,7 @@ uint8_t BuildAndSendDlPcchIndToMac(uint16_t cellId, uint16_t pf, uint8_t i_s, Cm
          if(ret != ROK)
          {
             DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macPcchInd->pcchPdu, macPcchInd->pduLen);
-            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macPcchInd, sizeof(MacPcchInd));
+            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, macPcchInd, sizeof(DlPcchInd));
             break;
          }
       }
@@ -854,7 +869,7 @@ uint8_t insertPagingRecord(DuCellCb* cellCb, DuPagingMsg *rcvdF1apPagingParam, u
 #if 0
    printPageList(&(cellCb->pagingInfoMap));
 #endif
-   
+
    return ROK;
 
 
@@ -995,7 +1010,6 @@ uint8_t calcAndFillPagingInfoInCellCb(DuCellCb* cellCb, DuPagingMsg *rcvdF1apPag
       rcvdF1apPagingParam->pagingFrame =  (sfn % MAX_SFN);
       rcvdF1apPagingParam->i_s = ((uint32_t)(floor(rcvdF1apPagingParam->pagUeId / N)) % ns);
 
-      DU_LOG("\nINFO   --> DU APP : Successfully filled paging parameter in DuCellCb");
       memcpy(&cellCb->tmpPagingInfoOfUe, rcvdF1apPagingParam, sizeof(DuPagingMsg));
    }
    else