1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /* This file contains message handling functionality for DU cell management */
20 #include "common_def.h"
27 #include "du_app_mac_inf.h"
28 #include "du_app_rlc_inf.h"
32 #include "du_cell_mgr.h"
33 #include "PCCH-Config.h"
37 #include "AlarmInterface.h"
38 #include "CmInterface.h"
42 DuMacCellDeleteReq packMacCellDeleteReqOpts[] =
44 packDuMacCellDeleteReq, /* Loose coupling */
45 MacProcCellDeleteReq, /* TIght coupling */
46 packDuMacCellDeleteReq /* Light weight-loose coupling */
49 /*******************************************************************
51 * @brief Processes cells to be activated
55 * Function : duProcCellsToBeActivated
58 * - Processes cells to be activated list received in F1SetupRsp
61 * @return ROK - success
64 * ****************************************************************/
65 uint8_t duProcCellsToBeActivated(uint8_t *plmnStr, uint16_t nci, uint16_t nRPci)
68 DuCellCb *cellCb = NULLP;
69 uint8_t cfgIdx, tmpPlmn[4];
71 for(cfgIdx=0; cfgIdx<duCb.numCfgCells; cfgIdx++)
73 memset(tmpPlmn, 0, 4);
74 buildPlmnId(duCb.cfgCellLst[cfgIdx]->cellInfo.nrEcgi.plmn, tmpPlmn);
75 if(duCb.cfgCellLst[cfgIdx]->cellInfo.nrEcgi.cellId == nci &&
76 (strcmp((const char*)tmpPlmn, (const char*)plmnStr) == 0))
78 cellCb = duCb.cfgCellLst[cfgIdx];
83 DU_LOG("\nERROR --> DU APP : No Cell found for NCI %d", nci);
88 cellCb->cellStatus = ACTIVATION_IN_PROGRESS;
89 cellCb->cellInfo.nrPci = nRPci;
91 if((cmHashListInit(&(cellCb->pagingInfoMap), MAX_SFN, sizeof(DuPagInfoList),\
92 FALSE, CM_HASH_KEYTYPE_CONID, DU_APP_MEM_REGION, DU_POOL)) != ROK)
94 DU_LOG("ERROR --> DU APP: Failed to Initialize the Paging Hash Map");
97 duCb.actvCellLst[cellCb->cellId -1] = cellCb;
100 if(duBuildAndSendMacCellCfg(cellCb->cellId) != ROK)
102 DU_LOG("\nERROR --> DU APP : macCellCfg build and send failed");
103 /* Delete cell from actvCellList */
104 duCb.actvCellLst[cellCb->cellId -1] = NULLP;
105 --(duCb.numActvCells);
111 /*******************************************************************
113 * @brief Handles DU F1Setup Rsp received in F1AP
117 * Function : duProcF1SetupRsp
120 * - Handles DU F1Setup Rsp received in F1AP
122 * @params[in] Pointer to F1SetupRsp
125 ******************************************************************/
126 void duProcF1SetupRsp()
128 DU_LOG("\nINFO --> DU_APP : F1 Setup Response received");
129 duCb.f1Status = TRUE; //Set F1 status as true
132 /*******************************************************************
134 * @brief Returns cellCb based on cell ID
138 * Function : duGetCellCb
140 * Functionality: Returns DU APP CellCb based on cell ID
142 * @params[in] F1AP_PDU_t ASN decoded F1AP message
143 * @return ROK - success
146 * ****************************************************************/
147 uint8_t duGetCellCb(uint16_t cellId, DuCellCb **cellCb)
151 for(cellIdx=0; cellIdx < MAX_NUM_CELL; cellIdx++)
153 if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->cellId == cellId))
155 *cellCb = duCb.actvCellLst[cellIdx];
162 DU_LOG("\nERROR --> DU APP : Cell Id %d not found in DU APP", cellId);
169 /*****************************************************************
170 * @brief Handles slot indication from MAC
174 * Function : duHandleSlotInd
177 * Handles slot indication from MAC
179 * @params[in] Post structure pointer
180 * SlotTimingInfo *slotIndInfo
181 * @return ROK - success
185 *****************************************************************/
186 uint8_t duHandleSlotInd(Pst *pst, SlotTimingInfo *slotIndInfo)
188 uint8_t cellIdx = 0, ret = ROK;
193 GET_CELL_IDX(slotIndInfo->cellId, cellIdx);
194 duCellCb = duCb.actvCellLst[cellIdx];
198 duCellCb->currSlotInfo.sfn = slotIndInfo->sfn;
199 duCellCb->currSlotInfo.slot = slotIndInfo->slot;
203 DU_LOG("\nERROR --> DU APP : CellId[%d] doesnot exist", slotIndInfo->cellId);
206 DU_FREE_SHRABL_BUF(pst->region, pst->pool, slotIndInfo, sizeof(SlotTimingInfo));
210 DU_LOG("\nERROR --> DU APP : Recevied null pointer from MAC");
215 /*******************************************************************
217 * @brief Handles cell up indication from MAC
221 * Function : duHandleCellUpInd
224 * Handles cell up indication from MAC
226 * @params[in] Post structure pointer
228 * @return ROK - success
231 * ****************************************************************/
232 uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId)
234 DuCellCb *cellCb = NULLP;
236 if(cellId->cellId <=0 || cellId->cellId > MAX_NUM_CELL)
238 DU_LOG("\nERROR --> DU APP : Invalid Cell Id %d in duHandleCellUpInd()", cellId->cellId);
242 if(duGetCellCb(cellId->cellId, &cellCb) != ROK)
245 if((cellCb != NULL) && (cellCb->cellStatus == ACTIVATION_IN_PROGRESS))
247 DU_LOG("\nINFO --> DU APP : 5G-NR Cell %d is UP", cellId->cellId);
248 cellCb->cellStatus = ACTIVATED;
249 gCellStatus = CELL_UP;
251 if(duCfgParam.tempSliceCfg.rrmPolicy)
252 BuildAndSendSliceConfigReq(duCfgParam.tempSliceCfg.rrmPolicy, duCfgParam.tempSliceCfg.totalRrmPolicy, duCfgParam.tempSliceCfg.totalSliceCount);
254 DU_LOG("\nINFO --> DU APP : Raise cell UP alarm for cell id=%d", cellId->cellId);
255 raiseCellAlrm(CELL_UP_ALARM_ID, cellId->cellId);
256 setCellOpState(cellId->cellId, ENABLED, ACTIVE);
261 if((pst->selector == ODU_SELECTOR_LWLC) || (pst->selector == ODU_SELECTOR_TC))
262 DU_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, sizeof(OduCellId));
266 /*******************************************************************
268 * @brief Handle Cell delete response from MAC
272 * Function : DuProcMacCellDeleteRsp
274 * Functionality: Handle Cell delete response from MAC
276 * @params[in] Pointer to MacCellDeleteRsp and Pst
277 * @return ROK - success
280 * ****************************************************************/
282 uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *deleteRsp)
289 if(deleteRsp->result == SUCCESSFUL_RSP)
291 GET_CELL_IDX(deleteRsp->cellId, cellIdx);
292 DU_LOG("\nINFO --> DU APP : MAC CELL Delete Response : SUCCESS [CELL IDX : %d]", deleteRsp->cellId);
293 if(duCb.actvCellLst[cellIdx] && (duCb.actvCellLst[cellIdx]->cellId == deleteRsp->cellId))
295 memset(duCb.actvCellLst[cellIdx], 0, sizeof(DuCellCb));
296 gCellStatus = CELL_DOWN;
299 DU_LOG("\nINFO --> DU APP : Raise cell down alarm for cell id=%d", deleteRsp->cellId);
300 raiseCellAlrm(CELL_DOWN_ALARM_ID, deleteRsp->cellId);
301 setCellOpState(deleteRsp->cellId, DISABLED, INACTIVE);
306 DU_FREE(duCb.actvCellLst[cellIdx], sizeof(DuCellCb));
311 DU_LOG("\nERROR --> DU APP : DuProcMacCellDeleteRsp(): CellId [%d] doesnot exist", deleteRsp->cellId);
317 DU_LOG("\nERROR --> DU APP : DuProcMacCellDeleteRsp(): MAC CELL Delete Response : FAILED\
318 [CELL IDX : %d]", deleteRsp->cellId);
321 DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacCellDeleteRsp));
325 DU_LOG("\nERROR --> DU APP : DuProcMacCellDeleteRsp(): Received MAC cell delete response is NULL");
331 /*******************************************************************
333 * @brief Sending Cell Delete Req To Mac
337 * Function : sendCellDeleteReqToMac
340 * sending Cell Delete Req To Mac
342 * @params[in] uint16_t cellId
343 * @return ROK - success
347 *****************************************************************/
349 uint8_t sendCellDeleteReqToMac(uint16_t cellId)
353 MacCellDelete *cellDelete = NULLP;
355 DU_ALLOC_SHRABL_BUF(cellDelete, sizeof(MacCellDelete));
358 cellDelete->cellId = cellId;
359 FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_DELETE_REQ);
361 DU_LOG("\nINFO --> DU APP : Sending Cell Delete Request to MAC");
362 /* Processing one Cell at a time to MAC */
363 ret = (*packMacCellDeleteReqOpts[pst.selector])(&pst, cellDelete);
366 DU_LOG("\nERROR --> DU APP : sendCellDeleteReqToMac(): Failed to send Cell delete Req to MAC");
367 DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, cellDelete, sizeof(MacCellDelete));
372 DU_LOG("\nERROR --> DU APP : sendCellDeleteReqToMac(): Failed to allocate memory");
378 /*******************************************************************
380 * @brief DU preocess Cell Delete Req to MAC
384 * Function : duSendCellDeletReq
386 * Functionality: DU process Cell Delete Req to MAC
388 * @params[in] uint16_t cellId
389 * @return ROK - success
392 * ****************************************************************/
394 uint8_t duSendCellDeletReq(uint16_t cellId)
396 uint16_t cellIdx = 0;
397 DU_LOG("\nINFO --> DU APP : Processing Cell Delete Request ");
398 GET_CELL_IDX(cellId, cellIdx);
400 if(duCb.actvCellLst[cellIdx] == NULLP)
402 DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): CellId[%d] is not found", cellId);
406 if(duCb.actvCellLst[cellIdx]->cellId != cellId)
408 DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): CellId[%d] is not found", cellId);
413 if(duCb.actvCellLst[cellIdx]->cellStatus != DELETION_IN_PROGRESS)
415 DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): CellStatus[%d] of cellId[%d] is not correct.\
416 Expected CellStatus is DELETION_IN_PROGRESS",duCb.actvCellLst[cellIdx]->cellStatus, cellId);
420 if(duBuildAndSendMacCellStop(cellId) == RFAILED)
422 DU_LOG("\nERROR --> DU APP : duSendCellDeletReq(): Failed to build and send cell stop request to MAC for\
430 /*******************************************************************
431 * @brief Find the PageInfo List from HashMap
435 * Function : findPagingInfoFromMap
437 * Functionality: Search for the PageInfoList for a PF from HashMap
439 * @params[in] uint16_t pf, CmHashListCp *pagingInfoMap
441 * @return DuPagInfoList
443 * ****************************************************************/
444 DuPagInfoList* findPagingInfoFromMap(uint16_t pf, CmHashListCp *pagingInfoMap)
446 DuPagInfoList *pagInfoLL = NULLP;
448 cmHashListFind(pagingInfoMap, (uint8_t *)&(pf), sizeof(uint16_t), 0, (PTR *)&pagInfoLL);
449 if(pagInfoLL == NULLP)
451 DU_LOG("\nDEBUG --> DU APP: PF:%d doesnt exist in Map",pf);
456 /*******************************************************************
457 * @brief Handle the PageInfo List
461 * Function : handlePageInfoLL
463 * Functionality: Handling the (SEARCH,CREATE,DELETE) PageInfoList
465 * @params[in] uint8_t i_s, CmLListCp *pagInfoLL, ActionTypeLL action
467 * @return DuPagUeList
469 * ****************************************************************/
470 DuPagUeList* handlePageInfoLL(uint8_t i_s, CmLListCp *pagInfoLL, ActionTypeLL action)
472 CmLList *node = NULLP;
473 DuPagUeList *pagInfo = NULLP;
476 if(pagInfoLL == NULLP)
478 DU_LOG("\nERROR --> DU APP: PagInfo LL is empty");
481 node = pagInfoLL->first;
485 pagInfo = (DuPagUeList *)node->node;
486 if(pagInfo->i_s == i_s)
510 /*Need to add a new node for this LC*/
512 /*List is empty; Initialize the LL ControlPointer*/
513 if(pagInfoLL->count == 0)
515 cmLListInit(pagInfoLL);
519 /*Allocate the List*/
520 DU_ALLOC(pagInfo, sizeof(DuPagUeList));
527 DU_LOG("\nERROR --> DU APP : Allocation of List failed,i_s:%d",i_s);
531 if(duAddNodeToLList(pagInfoLL, pagInfo, NULLP) == RFAILED)
533 DU_LOG("\nERROR --> DU APP : failed to Add Node,i_s:%d",i_s);
534 DU_FREE(pagInfo, sizeof(DuPagUeList));
541 if(!found || pagInfo == NULLP)
543 DU_LOG("\nERROR --> DU APP: i_s:%d not found; thus Deletion unsuccessful",i_s);
547 if(duDelNodeFromLList(pagInfoLL, node) == ROK)
548 DU_FREE(pagInfo, sizeof(DuPagUeList));
550 DU_LOG("\nDEBUG --> DU APP: i_s:%d Deleted successfully",i_s);
556 DU_LOG("\nERROR --> DU APP: Incorrect ActionType:%d on PageInfo List",action);
562 /*******************************************************************
563 * @brief Handle the PageUe List
567 * Function : handlePageUeLL
569 * Functionality: Handling the (SEARCH,CREATE,DELETE) PageUeList
571 * @params[in] DuPagingMsg *pagingParam, CmLListCp *pageUeLL, ActionTypeLL
574 * @return DuPagUeRecord
576 * ****************************************************************/
577 DuPagUeRecord* handlePageUeLL(DuPagingMsg *pagingParam, CmLListCp *pageUeLL, ActionTypeLL action)
579 CmLList *node = NULLP;
580 DuPagUeRecord *ueRecord = NULLP;
583 if(pageUeLL == NULLP)
585 DU_LOG("\nERROR --> DU APP: UE Page Record LL is empty");
588 node = pageUeLL->first;
592 ueRecord = (DuPagUeRecord *)node->node;
593 if(ueRecord && (ueRecord->pagUeId == pagingParam->pagUeId &&
594 ueRecord->sTmsi == pagingParam->sTmsi))
618 /*Need to add a new node for this LC*/
620 /*List is empty; Initialize the LL ControlPointer*/
621 if(pageUeLL->count == 0)
623 cmLListInit(pageUeLL);
627 /*Allocate the List*/
628 DU_ALLOC(ueRecord, sizeof(DuPagUeRecord));
631 ueRecord->pagUeId = pagingParam->pagUeId;
632 ueRecord->sTmsi = pagingParam->sTmsi;
633 ueRecord->pagPriority = pagingParam->pagPriority;
637 DU_LOG("\nERROR --> DU APP : Allocation of UE Record failed,ueId:%d",pagingParam->pagUeId);
641 if(duAddNodeToLList(pageUeLL, ueRecord, NULLP) == RFAILED)
643 DU_LOG("\nERROR --> DU APP : failed to Add Ue Record Node,ueId:%d",pagingParam->pagUeId);
644 DU_FREE(ueRecord, sizeof(DuPagUeRecord));
651 if(!found || ueRecord == NULLP)
653 DU_LOG("\nERROR --> DU APP: UeId:%d not found; thus Deletion unsuccessful",pagingParam->pagUeId);
657 if(duDelNodeFromLList(pageUeLL, node) == ROK)
658 DU_FREE(ueRecord, sizeof(DuPagUeRecord));
660 DU_LOG("\nDEBUG --> DU APP: UeId:%d Deleted successfully",pagingParam->pagUeId);
666 DU_LOG("\nERROR --> DU APP: Incorrect ActionType:%d on UeRecord",action);
672 /*******************************************************************
673 * @brief Keeping the record of Paging having a particular SFN and index associated
677 * Function : insertPagingRecord
679 * Functionality: Insert record of Paging assoc with particular SFN and index associated
681 * @params[in] DuCellCb* cellCb, uint16_t iterations
682 * DuPagingMsg rcvdF1apPagingParam
684 * @return ROK - success
687 * ****************************************************************/
688 uint8_t insertPagingRecord(DuCellCb* cellCb, DuPagingMsg *rcvdF1apPagingParam, uint16_t iterations)
690 uint16_t maxIterations = 0;
691 DuPagInfoList *pagInfoLLFromPF = NULLP;
692 DuPagUeList *pageUeLL = NULLP;
693 DuPagUeRecord *ueRecord = NULLP;
695 //printPageList(&(cellCb->pagingInfoMap));
697 /*MAX Iteration : A UE can be paged at every T frames thus MAX determines
698 *how many Paging Frame(s) can be considered for Paging this UE*/
699 maxIterations = MAX_SFN/rcvdF1apPagingParam->T;
700 if(iterations >= maxIterations)
702 DU_LOG("\nERROR --> DU APP: MAX Iterations reached for UEID:%d, thus Paging is dropped!", rcvdF1apPagingParam->pagUeId);
706 /*[Step1]: Extracting the PF from the HasMap between PF and PagingInfoList*/
707 pagInfoLLFromPF = findPagingInfoFromMap(rcvdF1apPagingParam->pagingFrame, &(cellCb->pagingInfoMap));
708 if(pagInfoLLFromPF != NULLP)
710 /*[Step2]: Extracting the PageInfo List for the Paging Indices(i_s)*/
711 pageUeLL = handlePageInfoLL(rcvdF1apPagingParam->i_s, &(pagInfoLLFromPF->pagInfoList), CREATE);
713 if(pageUeLL != NULLP)
715 /*[Step3]: Check whether MAX UE Record against this PF and i_s has reached*/
716 if(pageUeLL->pagUeList.count < MAX_PAGING_UE_RECORDS)
718 /*[Step4]: Insert the Paging Record to the end of the UE record List*/
719 ueRecord = handlePageUeLL(rcvdF1apPagingParam, &(pageUeLL->pagUeList), CREATE);
721 if(ueRecord == NULLP)
723 DU_LOG("\nERROR --> DU APP: Unable to create UE Record in PagingList");
726 DU_LOG("\nDEBUG --> DU APP: UE Record created successfully in PagingList");
731 /*Since MAX Page record has reached for this PF thus calculating and
732 *moving this UE to next Paging Cycle*/
733 DU_LOG("\nINFO --> DU APP: Max Page Record reached for PagingFrame:%d",rcvdF1apPagingParam->pagingFrame);
734 rcvdF1apPagingParam->pagingFrame = ((rcvdF1apPagingParam->pagingFrame + rcvdF1apPagingParam->T) % MAX_SFN);
737 return insertPagingRecord(cellCb, rcvdF1apPagingParam, iterations);
741 /*Reaching here means that PF has no entry in the PageLists,
742 *Thus creating, Updating and inseritng the Paging Map, List and UE record.*/
744 DU_ALLOC(pagInfoLLFromPF, sizeof(DuPagInfoList));
746 if(pagInfoLLFromPF == NULLP)
748 DU_LOG("\nERROR --> DU APP: PageInfo Map allocation failed.");
751 pagInfoLLFromPF->pf = rcvdF1apPagingParam->pagingFrame;
752 pageUeLL = handlePageInfoLL(rcvdF1apPagingParam->i_s, &(pagInfoLLFromPF->pagInfoList), CREATE);
753 ueRecord = handlePageUeLL(rcvdF1apPagingParam, &(pageUeLL->pagUeList), CREATE);
754 if(cmHashListInsert(&(cellCb->pagingInfoMap), (PTR)pagInfoLLFromPF, (uint8_t *)&(pagInfoLLFromPF->pf), sizeof(uint16_t)) == RFAILED)
756 DU_LOG("\nERROR --> DU APP: Hash Map Insertion Failed for PF:%d.",rcvdF1apPagingParam->pagingFrame);
759 //printPageList(&(cellCb->pagingInfoMap));
765 /*******************************************************************
766 * @brief Calculate and fill paging information of a UE belongs to a particular cell
770 * Function : calcAndFillPagingInfoInCellCb
772 * Functionality: Calculate PO and i_s and
773 * fill paging information of a UE in DuCellCb
775 * @params[in] DuCellCb* cellCb, uint8_t pagUeId,
776 * DuPagingMsg rcvdF1apPagingParam
778 * @return ROK - success
781 * ****************************************************************/
782 uint8_t calcAndFillPagingInfoInCellCb(DuCellCb* cellCb, DuPagingMsg *rcvdF1apPagingParam)
785 uint16_t T=0, N=0, pagingFrame = 0, n = 0;
786 uint16_t currentSfn = 0, sfn = 0, newSfn = 0;
789 DU_LOG("\nINFO --> DU APP : Start filling paging parameters in DuCellCb");
792 /* calculate paging frame and paging offset */
793 duPcchCfg = duCfgParam.sib1Params.srvCellCfgCommSib.dlCfg.pcchCfg;
794 rcvdF1apPagingParam->pagingFrameOffset = duPcchCfg.pageFrameOffset;
798 * Fill the Value of T (DRX cycle of the UE)
799 * T = min(UE Specific DRX value allocated by upper layers, default DRX
800 * broadcast in System Information) */
801 if((rcvdF1apPagingParam->pagingDrxPres) && (duPcchCfg.dfltPagingCycle > rcvdF1apPagingParam->pagingDrx))
803 T = rcvdF1apPagingParam->pagingDrx;
807 T = duPcchCfg.dfltPagingCycle;
809 rcvdF1apPagingParam->T = T;
811 /* N= number of total paging frames in T */
813 switch(duPcchCfg.nAndPagingFrmOffsetType)
815 case PCCH_Config__nAndPagingFrameOffset_PR_oneT:
818 case PCCH_Config__nAndPagingFrameOffset_PR_halfT:
821 case PCCH_Config__nAndPagingFrameOffset_PR_quarterT:
824 case PCCH_Config__nAndPagingFrameOffset_PR_oneEighthT:
827 case PCCH_Config__nAndPagingFrameOffset_PR_oneSixteenthT:
835 /* calculate the Value of pagingFrame */
836 /*Refer: 38.304 Sec 7.1: (SFN + PF_offset) mod T = (T div N)*(UE_ID mod N)*/
837 //RHS of above formula
838 pagingFrame = (T / N) * ((rcvdF1apPagingParam->pagUeId) % N);
840 //LHS of above formula
843 pagingFrame = (pagingFrame - rcvdF1apPagingParam->pagingFrameOffset)%T;
845 else /*Paging Frame = 0 so thus PF will be calculated on Paging Cycle*/
847 pagingFrame = (T - rcvdF1apPagingParam->pagingFrameOffset)%T;
850 /*Paging Frame(SFN for Paging) has to be determined from current SFN. */
851 /*For eg: If T =128, PF(Calculated above) = 20; SFN can be 20,148,276,...
852 * If currSFN is running as 200 then (newSFN % T) == (T/N)*(UE_ID%N)
853 *Thus SFN at which paging has to be sent needs to be delayed and newSFN = 276*/
855 currentSfn = cellCb->currSlotInfo.sfn;
857 /*Multiplication Factor(x) to find the next best SFN to process paging*/
859 /*Below calculation will determine in which nth cycle of T (DRX cycle),new PF
860 * may fall(Delayed one)*/
861 if(currentSfn > pagingFrame)
863 n = ((currentSfn - pagingFrame) / T) + 1;
867 n = ((pagingFrame - currentSfn) / T) + 1;
870 newSfn = pagingFrame + T * n;
872 /*When pagingFrame is future from currSFN then pagingFrame will be used
873 * else pagingFrame is delayed thus newSFN will be used.*/
874 if(currentSfn <= pagingFrame)
876 if(pagingFrame > currentSfn + PAGING_SCHED_DELTA)
888 if(newSfn > currentSfn + PAGING_SCHED_DELTA)
892 else /*If newSFN is near to currSFN then delay it more by T*/
898 rcvdF1apPagingParam->pagingFrame = (sfn % MAX_SFN);
899 rcvdF1apPagingParam->i_s = ((uint32_t)(floor(rcvdF1apPagingParam->pagUeId / N)) % ns);
901 DU_LOG("\nINFO --> DU APP : Successfully filled paging parameter in DuCellCb");
902 memcpy(&cellCb->tmpPagingInfoOfUe, rcvdF1apPagingParam, sizeof(DuPagingMsg));
906 DU_LOG("\nINFO --> DU APP : calcAndFillPagingInfoInCellCb(): Received null pointer");
912 /*******************************************************************
913 * @brief Paging Processing on a particular cell
917 * Function : processPagingMsg
919 * Functionality: Process Paging on a particular cell
921 * @params[in] uint16_t cellId
922 * DuPagingMsg rcvdF1apPagingParam
924 * @return ROK - success
927 * ****************************************************************/
928 uint8_t processPagingMsg(uint16_t cellId, DuPagingMsg *rcvdF1apPagingParam)
930 uint16_t cellIdx = 0, iteration = 0;
932 GET_CELL_IDX(cellId, cellIdx);
934 if(duCb.actvCellLst[cellIdx] == NULLP || duCb.actvCellLst[cellIdx]->cellId != cellId)
936 DU_LOG("\nERROR --> DU APP : processPagingMsg(): CellId[%d] is not found", cellId);
940 if(calcAndFillPagingInfoInCellCb(duCb.actvCellLst[cellIdx], rcvdF1apPagingParam) != ROK)
942 DU_LOG("\nERROR --> DU APP : CellCb:%d not present to fill UE Paging Information",cellId);
945 if(insertPagingRecord(duCb.actvCellLst[cellIdx], rcvdF1apPagingParam, iteration) != ROK)
947 DU_LOG("\nERROR --> DU APP : Insertion Failed ofUE Paging Information");
953 /**********************************************************************
955 **********************************************************************/