From: barveankit Date: Thu, 28 Apr 2022 09:34:45 +0000 (+0530) Subject: [Epic-ID: ODUHIGH-406][Task-ID: ODUHIGH-440] Sending and Handling of PAGE REQ at MAC X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=o-du%2Fl2.git;a=commitdiff_plain;h=2b1e3e044e619637fafa8829789d6798d8f9bdb0 [Epic-ID: ODUHIGH-406][Task-ID: ODUHIGH-440] Sending and Handling of PAGE REQ at MAC Signed-off-by: barveankit Change-Id: I821bcd6e49882f4d7ea3b13ff4e9f3a4afbdc192 Signed-off-by: barveankit Signed-off-by: lal.harshita --- diff --git a/src/5gnrmac/mac_cfg_hdl.c b/src/5gnrmac/mac_cfg_hdl.c index b6f0fcab6..fae023324 100644 --- a/src/5gnrmac/mac_cfg_hdl.c +++ b/src/5gnrmac/mac_cfg_hdl.c @@ -77,6 +77,13 @@ MacDuSliceReCfgRspFunc macDuSliceReCfgRspOpts[] = packDuMacSliceReCfgRsp /* packing for light weight loosly coupled */ }; +MacSchPagingIndFunc macSchPagingIndOpts[] = +{ + packMacSchPagingInd, /* packing for loosely coupled */ + MacSchPagingInd, /* packing for tightly coupled */ + packMacSchPagingInd /* packing for light weight loosely coupled */ +}; + /** * @brief Layer Manager Configuration request handler for Scheduler * @@ -956,6 +963,87 @@ uint8_t MacProcSchSliceReCfgRsp(Pst *pst, SchSliceCfgRsp *schSliceRecfgRsp) } return ROK; } + +/** + * @brief Mac process the downlink pcch indication received from DUAPP + * + * @details + * + * Function : MacProcDlPcchInd + * + * This function process the downlink pcch indication received from DUAPP + * + * @param[in] Pst *pst + * @param[in] MacPcchInd *pcchInd + * @return int + * -# ROK + **/ +uint8_t MacProcDlPcchInd(Pst *pst, MacPcchInd *pcchInd) +{ + uint8_t ret = RFAILED; + uint16_t cellIdx = 0; + Pst schPst; + SchPageInd *schPageInd = NULLP; + + if(pcchInd) + { + DU_LOG("\nINFO --> MAC : Recived pcch request from DU_APP for cellId[%d]", pcchInd->cellId); + + GET_CELL_IDX(pcchInd->cellId, cellIdx); + + if(macCb.macCell[cellIdx] == NULLP || macCb.macCell[cellIdx]->cellId != pcchInd->cellId) + { + DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): CellId[%d] does not exist", pcchInd->cellId); + } + else + { + if((pcchInd->pcchPdu == NULLP) || (pcchInd->pduLen <= 0)) + { + DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): Received Pcch pdu is null"); + } + else + { + MAC_ALLOC(schPageInd, sizeof(SchPageInd)); + if(schPageInd == NULLP) + { + DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): Failed to allocate memory"); + } + else + { + schPageInd->cellId = pcchInd->cellId; + schPageInd->pf = pcchInd->pf; + schPageInd->i_s = pcchInd->i_s; + schPageInd->pduLen = pcchInd->pduLen; + + MAC_ALLOC(schPageInd->pagePdu, pcchInd->pduLen); + if(schPageInd->pagePdu == NULLP) + { + DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): Failed to allocate memory"); + MAC_FREE(schPageInd, sizeof(SchPageInd)); + } + else + { + memcpy(schPageInd->pagePdu, pcchInd->pcchPdu, pcchInd->pduLen); + + DU_LOG("\nINFO --> MAC : Sending paging indication to SCH"); + FILL_PST_MAC_TO_SCH(schPst, EVENT_PAGING_IND_TO_SCH); + ret = (*macSchPagingIndOpts[schPst.selector])(&schPst, schPageInd); + } + } + } + } + if((pcchInd->pcchPdu) && (pcchInd->pduLen > 0)) + { + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, pcchInd->pcchPdu, pcchInd->pduLen); + } + MAC_FREE_SHRABL_BUF(pst->region, pst->pool, pcchInd, sizeof(MacPcchInd)); + } + else + { + DU_LOG("\nERROR --> MAC : MacProcDlPcchInd(): Received Null pointer"); + } + return ret; +} /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrmac/mac_msg_router.c b/src/5gnrmac/mac_msg_router.c index 057557c6f..e55c7096f 100755 --- a/src/5gnrmac/mac_msg_router.c +++ b/src/5gnrmac/mac_msg_router.c @@ -169,6 +169,12 @@ Buffer *mBuf /* message buffer */ unpackMacRachRsrcReq(MacProcRachRsrcReq, pst, mBuf); break; } + case EVENT_MAC_DL_PCCH_IND: + { + /* Process Pcch indication */ + unpackMacDlPcchInd(MacProcDlPcchInd, pst, mBuf); + break; + } default: RG_FREE_MSG(mBuf); diff --git a/src/5gnrsch/sch.c b/src/5gnrsch/sch.c index fe18fec2e..d561b1edd 100644 --- a/src/5gnrsch/sch.c +++ b/src/5gnrsch/sch.c @@ -72,6 +72,7 @@ SchSliceReCfgRspFunc SchSliceReCfgRspOpts[] = MacProcSchSliceReCfgRsp, /* TC */ packSchSliceReCfgRsp /* LWLC */ }; + /** * @brief Task Initiation function. * @@ -2101,6 +2102,154 @@ void schCfgPdcchMonOccOfPO(SchCellCb *cell) } } +/**************************************************************************** + * + * @brief Storing the paging information in SCH database + * + * @details + * + * Function : schAddPagingIndtoList + * + * Functionality: Storing the paging information in SCH database + * + * @params[in] CmLListCp *storedPageList, CmLList *pageIndInfo + * + * @return ROK - sucess + * RFAILED - failure + * + *************************************************************************/ +uint8_t schAddPagingIndtoList(CmLListCp *storedPageList,void * pageIndInfo) +{ + CmLList *firstNodeOfList = NULLP; + CmLList *currentNodeInfo = NULLP; + SchPageInfo *tempNode = NULLP, *recvdNode = NULLP; + + recvdNode = (SchPageInfo*) pageIndInfo; + CM_LLIST_FIRST_NODE(storedPageList,firstNodeOfList); + + SCH_ALLOC(currentNodeInfo, sizeof(CmLList)); + if(!currentNodeInfo) + { + DU_LOG("\nERROR --> SCH : schAddPagingIndtoList() : Memory allocation failed"); + return RFAILED; + } + + currentNodeInfo->node = (PTR)pageIndInfo; + while(firstNodeOfList) + { + tempNode = (SchPageInfo*)(firstNodeOfList->node); + if ((recvdNode->TxTime.slot < tempNode->TxTime.slot)) + { + cmLListInsCrnt(storedPageList, currentNodeInfo); + break; + } + else if ((recvdNode->TxTime.slot == tempNode->TxTime.slot)) + { + DU_LOG("\nERROR --> SCH : schAddPagingIndtoList() : Slot[%d] is already present in the list", recvdNode->TxTime.slot); + return RFAILED; + } + else + { + CM_LLIST_NEXT_NODE(storedPageList, firstNodeOfList); + } + } + + if(!firstNodeOfList) + { + cmLListAdd2Tail(storedPageList, currentNodeInfo); + } + DU_LOG("\nINFO --> SCH : Paging information is stored sucessfully"); + return ROK; +} + +/**************************************************************************** + * + * @brief Process paging indication at SCH recevied form MAC + * + * @details + * + * Function : MacSchPagingInd + * + * Functionality: Process paging indication at SCH recevied form MAC + * + * @params[in] Pst *pst, SchPageInd *pageInd + * + * @return void + * + *************************************************************************/ +uint8_t MacSchPagingInd(Pst *pst, SchPageInd *pageInd) +{ + uint8_t ret = RFAILED; + uint16_t cellIdx = 0; + Inst inst = pst->dstInst - SCH_INST_START; + SchCellCb *cellCb = NULLP; + SchPageInfo *pageInfo = NULLP; + + if(pageInd) + { + DU_LOG("\nINFO --> SCH : Received paging indication form MAC for cellId[%d]",pageInd->cellId); + + /* Fetch Cell CB */ + for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++) + { + if((schCb[inst].cells[cellIdx]) && (schCb[inst].cells[cellIdx]->cellId == pageInd->cellId)) + { + cellCb = schCb[inst].cells[cellIdx]; + break; + } + } + if(cellCb) + { + if(pageInd->i_s > cellCb->cellCfg.sib1SchCfg.pageCfg.numPO) + { + DU_LOG("\nERROR --> SCH : MacSchPagingInd(): i_s should not be greater than number of paging occasion"); + } + else + { + SCH_ALLOC(pageInfo, sizeof(SchPageInfo)); + if(pageInfo) + { + pageInfo->pf = pageInd->pf; + pageInfo->i_s = pageInd->i_s; + pageInfo->TxTime.cellId = pageInd->cellId; + pageInfo->TxTime.sfn = (pageInd->pf + cellCb->pageCb.pagMonOcc[pageInd->i_s].frameOffset) % MAX_SFN; + pageInfo->TxTime.slot = cellCb->pageCb.pagMonOcc[pageInd->i_s].pagingOccSlot; + pageInfo->mcs = DEFAULT_MCS; + pageInfo->msgLen = pageInd->pduLen; + SCH_ALLOC(pageInfo->pagePdu, pageInfo->msgLen); + if(!pageInfo->pagePdu) + { + DU_LOG("\nERROR --> SCH : MacSchPagingInd(): Failed to allocate memory"); + } + else + { + memcpy(pageInfo->pagePdu, pageInd->pagePdu, pageInfo->msgLen); + ret = schAddPagingIndtoList(&cellCb->pageCb.pageIndInfoRecord[pageInfo->TxTime.sfn], pageInfo); + if(ret != ROK) + { + DU_LOG("\nERROR --> SCH : MacSchPagingInd(): Failed to store paging record"); + } + } + } + else + { + DU_LOG("\nERROR --> SCH : MacSchPagingInd(): Failed to allocate memory"); + } + } + } + else + { + DU_LOG("\nERROR --> SCH : Cell ID [%d] not found", pageInd->cellId); + } + SCH_FREE(pageInd->pagePdu, pageInd->pduLen); + SCH_FREE(pageInd, sizeof(SchPageInd)); + } + else + { + DU_LOG("\nERROR --> SCH : MacSchPagingInd(): Received null pointer"); + } + return ret; +} /********************************************************************** End of file **********************************************************************/ diff --git a/src/5gnrsch/sch.h b/src/5gnrsch/sch.h index 39b895852..1e1724f7e 100644 --- a/src/5gnrsch/sch.h +++ b/src/5gnrsch/sch.h @@ -292,7 +292,7 @@ typedef struct schRaReq typedef struct schPageInfo { - uint8_t pf; /*Value of Paging Frame received from DUAPP*/ + uint16_t pf; /*Value of Paging Frame received from DUAPP*/ uint8_t i_s; /*Value of Paging Occ Index received from DUAPP*/ SlotTimingInfo TxTime; /*Start Paging window*/ uint8_t crntSsbIdx; /*Counts the slot till totalSSB is receached*/ @@ -310,7 +310,7 @@ typedef struct schPagingOcc typedef struct schPageCb { - CmLListCp pageReqInfoRecord[MAX_SFN]; /*List of Page Records received which are stored per sfn*/ + CmLListCp pageIndInfoRecord[MAX_SFN]; /*List of Page Records received which are stored per sfn*/ SchPagingOcc pagMonOcc[MAX_PO_PER_PF]; /*Paging Occasion Slot/FrameOffset are stored*/ SchPageInfo currPageInfo; /*Page Req which is being currently processed */ }SchPageCb; diff --git a/src/cm/du_app_mac_inf.c b/src/cm/du_app_mac_inf.c index 84dc32f98..7b56931d0 100644 --- a/src/cm/du_app_mac_inf.c +++ b/src/cm/du_app_mac_inf.c @@ -1730,6 +1730,85 @@ uint8_t unpackDuMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf) return RFAILED; } +/******************************************************************* + * + * @brief Pack and send Dl Pcch indication to MAC + * + * @details + * + * Function : packDuMacDlPcchInd + * + * Functionality: + * Pack and send Dl Pcch indication to MAC + * + * @params[in] Post structure + * MacPcchInd *pcchInd; + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t packDuMacDlPcchInd(Pst *pst, MacPcchInd *pcchInd) +{ + Buffer *mBuf = NULLP; + + if(pst->selector == ODU_SELECTOR_LWLC) + { + if (ODU_GET_MSG_BUF(pst->region, pst->pool, &mBuf) != ROK) + { + DU_LOG("\nERROR --> MAC : packDuMacDlPcchInd(): Memory allocation failed "); + return RFAILED; + } + CMCHKPK(oduPackPointer,(PTR)pcchInd, mBuf); + return ODU_POST_TASK(pst,mBuf); + } + else + { + DU_LOG("\nERROR --> MAC: packDuMacDlPcchInd(): Only LWLC supported "); + } + return RFAILED; +} + +/******************************************************************* + * + * @brief Unpacks downlink pcch indication received from DU APP + * + * @details + * + * Function : unpackMacDlPcchInd + * + * Functionality: + * Unpacks downlink pcch indication received from DU APP + * + * @params[in] Pointer to Handler + * Post structure pointer + * Message Buffer + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t unpackMacDlPcchInd(DuMacDlPcchInd func, Pst *pst, Buffer *mBuf) +{ + if(pst->selector == ODU_SELECTOR_LWLC) + { + MacPcchInd *pcchInd=NULLP; + + /* unpack the address of the structure */ + CMCHKUNPK(oduUnpackPointer, (PTR *)&pcchInd, mBuf); + ODU_PUT_MSG_BUF(mBuf); + return (*func)(pst, pcchInd); + } + else + { + /* Nothing to do for other selectors */ + DU_LOG("\nERROR --> DU APP : unpackMacDlPcchInd(): Only LWLC supported"); + ODU_PUT_MSG_BUF(mBuf); + } + + return RFAILED; +} + /******************************************************************* * * @brief Searches for first unset bit in ueBitMap diff --git a/src/cm/du_app_mac_inf.h b/src/cm/du_app_mac_inf.h index 4815b4cab..d42617f2e 100644 --- a/src/cm/du_app_mac_inf.h +++ b/src/cm/du_app_mac_inf.h @@ -82,6 +82,7 @@ #define EVENT_MAC_SLOT_IND 220 #define EVENT_MAC_RACH_RESOURCE_REQ 221 #define EVENT_MAC_RACH_RESOURCE_RSP 222 +#define EVENT_MAC_DL_PCCH_IND 223 #define BSR_PERIODIC_TIMER_SF_10 10 #define BSR_RETX_TIMER_SF_320 320 @@ -1381,14 +1382,14 @@ typedef struct macSliceCfgRsp MacSliceRsp **listOfSliceCfgRsp; }MacSliceCfgRsp; -typedef struct macPageReq +typedef struct macPcchInd { uint16_t cellId; uint16_t pf; uint8_t i_s; uint16_t pduLen; - uint8_t *pagePdu; -}MacPageReq; + uint8_t *pcchPdu; +}MacPcchInd; /* Functions for CellUp Ind from MAC to DU APP*/ typedef uint8_t (*DuMacCellUpInd) ARGS(( @@ -1507,6 +1508,11 @@ typedef uint8_t (*MacDuSliceReCfgRspFunc) ARGS(( Pst *pst, MacSliceCfgRsp *cfgRsp)); +/* Pcch indication from DU APP to MAC*/ +typedef uint8_t (*DuMacDlPcchInd) ARGS(( + Pst *pst, + MacPcchInd *pcchInd)); + uint64_t ueBitMapPerCell[MAX_NUM_CELL]; /* Bit Map to store used/free UE-IDX per Cell */ uint8_t packMacCellUpInd(Pst *pst, OduCellId *cellId); @@ -1576,6 +1582,9 @@ uint8_t unpackDuMacSliceReCfgRsp(MacDuSliceReCfgRspFunc func, Pst *pst, Buffer * uint8_t duHandleSlotInd(Pst *pst, SlotTimingInfo *slotIndInfo); uint8_t packMacSlotInd(Pst *pst, SlotTimingInfo *slotIndInfo); uint8_t unpackDuMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf); +uint8_t packDuMacDlPcchInd(Pst *pst, MacPcchInd *pcchInd); +uint8_t MacProcDlPcchInd(Pst *pst, MacPcchInd *pcchInd); +uint8_t unpackMacDlPcchInd(DuMacDlPcchInd func, Pst *pst, Buffer *mBuf); int8_t getFreeBitFromUeBitMap(uint16_t cellId); void unsetBitInUeBitMap(uint16_t cellId, uint8_t bitPos); #endif diff --git a/src/cm/mac_sch_interface.c b/src/cm/mac_sch_interface.c index 397697ce1..b6dc192df 100644 --- a/src/cm/mac_sch_interface.c +++ b/src/cm/mac_sch_interface.c @@ -608,6 +608,35 @@ uint8_t packSchSliceReCfgRsp(Pst *pst, SchSliceCfgRsp *cfgRsp) return ROK; } +/******************************************************************* + * + * @brief Pack and Send paging indication from MAC to SCH + * + * @details + * + * Function : packMacSchPagingInd + * + * Functionality: + * Pack and Send paging indication from MAC to SCH + * + * @params[in] Pst *pst, SchPageInd *pageInd + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ +uint8_t packMacSchPagingInd(Pst *pst, SchPageInd *pageInd) +{ + if((pst->selector == ODU_SELECTOR_LC) || (pst->selector == ODU_SELECTOR_LC)) + { + /* TODO */ + } + else + { + return RFAILED; + } + return ROK; +} + /********************************************************************** End of file **********************************************************************/ diff --git a/src/cm/mac_sch_interface.h b/src/cm/mac_sch_interface.h index d09063a84..51fece286 100644 --- a/src/cm/mac_sch_interface.h +++ b/src/cm/mac_sch_interface.h @@ -43,6 +43,7 @@ #define EVENT_SLICE_RECFG_RSP_TO_MAC 24 #define EVENT_RACH_RESOURCE_REQUEST_TO_SCH 25 #define EVENT_RACH_RESOURCE_RESPONSE_TO_MAC 26 +#define EVENT_PAGING_IND_TO_SCH 27 /*macros*/ #define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */ @@ -1704,6 +1705,15 @@ typedef struct schSliceRsp SliceRsp **listOfSliceCfgRsp; }SchSliceCfgRsp; +typedef struct schPageInd +{ + uint16_t cellId; + uint16_t pf; + uint8_t i_s; + uint16_t pduLen; + uint8_t *pagePdu; +}SchPageInd; + /* function pointers */ typedef uint8_t (*SchCellCfgCfmFunc) ARGS(( Pst *pst, /* Post Structure */ @@ -1808,6 +1818,10 @@ typedef uint8_t (*SchSliceReCfgRspFunc) ARGS(( SchSliceCfgRsp *schSliceReCfgRsp /* Cell ReCfg Cfm */ )); +typedef uint8_t (*MacSchPagingIndFunc) ARGS(( + Pst *pst, /* Post structure */ + SchPageInd *schPagingInd)); /* Paging Indication */ + /* function declarations */ uint8_t packMacSchSlotInd(Pst *pst, SlotTimingInfo *slotInd); uint8_t packSchMacDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo); @@ -1861,6 +1875,8 @@ uint8_t packMacSchSliceReCfgReq(Pst *pst, SchSliceCfgReq *cfgReq); uint8_t MacSchSliceReCfgReq(Pst *pst, SchSliceCfgReq *schSliceCfgReq); uint8_t packSchSliceReCfgRsp(Pst *pst, SchSliceCfgRsp *cfgRsp); uint8_t MacProcSchSliceReCfgRsp(Pst *pst, SchSliceCfgRsp *sliceReCfgrsp); +uint8_t packMacSchPagingInd(Pst *pst, SchPageInd *pageInd); +uint8_t MacSchPagingInd(Pst *pst, SchPageInd *pageInd); /********************************************************************** End of file **********************************************************************/ diff --git a/src/du_app/du_cell_mgr.c b/src/du_app/du_cell_mgr.c index c689685d3..926dc7c5d 100644 --- a/src/du_app/du_cell_mgr.c +++ b/src/du_app/du_cell_mgr.c @@ -53,6 +53,13 @@ DuMacCellDeleteReq packMacCellDeleteReqOpts[] = packDuMacCellDeleteReq /* Light weight-loose coupling */ }; +DuMacDlPcchInd packMacDlPcchIndOpts[] = +{ + packDuMacDlPcchInd, /* Loose coupling */ + MacProcDlPcchInd, /* TIght coupling */ + packDuMacDlPcchInd /* Light weight-loose coupling */ +}; + /******************************************************************* * * @brief Processes cells to be activated @@ -211,7 +218,7 @@ uint8_t checkPagingRecord(DuCellCb *cellCb) pagInfo = handlePageInfoLL(pf, NULLD, &(pagInfoLLFromPF->pagInfoList), TRAVERSE_ALL); if(pagInfo != NULLP) { - if(buildAndSendPagingReqToMac(pf, pagInfo->i_s, &(pagInfo->pagUeList)) != ROK) + if(BuildAndSendDlPcchIndToMac(cellCb->cellId, pf, pagInfo->i_s, &(pagInfo->pagUeList)) != ROK) { DU_LOG("\nERROR --> DU APP: Issue in Building Page RRC PDU i_s:%d",pagInfo->i_s); return RFAILED; @@ -224,6 +231,48 @@ uint8_t checkPagingRecord(DuCellCb *cellCb) return ROK; } +/****************************************************************** + * + * @brief Send pcch indication to MAC + * + * @details + * + * Function : sendDlPcchIndToMac + * + * Functionality: Send pcch indication to MAC + * + * @Params[in] MacPcchInd *pcchInd + * @return ROK - success + * RFAILED - failure + * + * ****************************************************************/ + +uint8_t sendDlPcchIndToMac(MacPcchInd *pcchInd) +{ + uint8_t ret = ROK; + Pst pst; + + if(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) + { + DU_LOG("\nERROR --> DU APP : sendDlPcchIndToMac(): Failed to DL PCCH indication to MAC"); + } + } + else + { + DU_LOG("\nERROR --> DU_APP: sendDlPcchIndToMac(): Received pcchInd is NULLP"); + ret = RFAILED; + } + return ret; +} + + /***************************************************************** * @brief Handles slot indication from MAC * @@ -538,31 +587,30 @@ void freePcchPdu(PCCH_Message_t *pcchMsg) } /******************************************************************* - * @brief Builds the Paging RRC PDU and forwards it to MAC + * @brief Builds the Pcch RRC PDU and forwards it to MAC * * @details * - * Function : buildAndSendPagingReqToMac + * Function : BuildAndSendDlPcchIndToMac * - * Functionality: Builds the Paging RRC PDU[As per Spec 38.331, Annexure A] + * Functionality: Builds the Pcch RRC PDU[As per Spec 38.331, Annexure A] * and forwards it to MAC as Buffer along with PF and i_s * - * @params[in] uint16_t pf, uint8_t i_s,CmLListCp *pageUeLL + * @params[in] uint16_t cellId, uint16_t pf, uint8_t i_s,CmLListCp *pageUeLL * * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t buildAndSendPagingReqToMac(uint16_t pf, uint8_t i_s, CmLListCp *pageUeLL) +uint8_t BuildAndSendDlPcchIndToMac(uint16_t cellId, uint16_t pf, uint8_t i_s, CmLListCp *pageUeLL) { CmLList *node = NULLP, *next = NULLP; DuPagUeRecord *ueRecord = NULLP; PCCH_Message_t *pcchMsg = NULLP; - asn_enc_rval_t encRetVal; + asn_enc_rval_t encRetVal; PagingRrc_t *pagingMsg = NULLP; - MacPageReq *macPageReq = NULLP; - uint16_t bufIdx = 0; - uint8_t recordIdx = 0, ret = RFAILED; + MacPcchInd *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 */ uint8_t totalByteInTmsi = 6, unusedBitsInTmsi = 0; @@ -579,14 +627,14 @@ uint8_t buildAndSendPagingReqToMac(uint16_t pf, uint8_t i_s, CmLListCp *pageUeLL DU_ALLOC(pcchMsg , sizeof(PCCH_Message_t)); if(pcchMsg == NULLP) { - DU_LOG("\nERROR --> DU APP: buildAndSendPagingToMac(): (pccchMsg) Memory Alloction failed!"); + DU_LOG("\nERROR --> DU APP: BuildAndSendDlPcchIndToMac(): (pccchMsg) Memory Alloction failed!"); break; } pcchMsg->message.present = PCCH_MessageType_PR_c1; DU_ALLOC(pcchMsg->message.choice.c1 , sizeof(PCCH_MessageType_t)); if(pcchMsg->message.choice.c1 == NULLP) { - DU_LOG("\nERROR --> DU APP: buildAndSendPagingToMac(); (C1) Memory Alloction failed!"); + DU_LOG("\nERROR --> DU APP: BuildAndSendDlPcchIndToMac(); (C1) Memory Alloction failed!"); break; } pcchMsg->message.choice.c1->present = PCCH_MessageType__c1_PR_paging; @@ -595,13 +643,13 @@ uint8_t buildAndSendPagingReqToMac(uint16_t pf, uint8_t i_s, CmLListCp *pageUeLL pagingMsg = pcchMsg->message.choice.c1->choice.paging; if(pagingMsg == NULLP) { - DU_LOG("\nERROR --> DU APP: buildAndSendPagingToMac(); (Paging) Memory Alloction failed!"); + DU_LOG("\nERROR --> DU APP: BuildAndSendDlPcchIndToMac(); (Paging) Memory Alloction failed!"); break; } DU_ALLOC(pagingMsg->pagingRecordList, sizeof(PagingRecordList_t)); if(pagingMsg->pagingRecordList == NULLP) { - DU_LOG("\nERROR --> DU APP: buildAndSendPagingToMac(); (Paging Record List) Memory Alloction failed!"); + DU_LOG("\nERROR --> DU APP: BuildAndSendDlPcchIndToMac(); (Paging Record List) Memory Alloction failed!"); break; } @@ -617,7 +665,7 @@ uint8_t buildAndSendPagingReqToMac(uint16_t pf, uint8_t i_s, CmLListCp *pageUeLL DU_ALLOC(pagingMsg->pagingRecordList->list.array, pagingMsg->pagingRecordList->list.size); if(pagingMsg->pagingRecordList->list.array == NULLP) { - DU_LOG("\nERROR --> DU APP: buildAndSendPagingToMac(); (Array) Memory Alloction failed!"); + DU_LOG("\nERROR --> DU APP: BuildAndSendDlPcchIndToMac(); (Array) Memory Alloction failed!"); break; } for(recordIdx = 0; recordIdx < pageUeLL->count; recordIdx++) @@ -625,7 +673,7 @@ uint8_t buildAndSendPagingReqToMac(uint16_t pf, uint8_t i_s, CmLListCp *pageUeLL DU_ALLOC(pagingMsg->pagingRecordList->list.array[recordIdx], sizeof(PagingRecord_t)); if(pagingMsg->pagingRecordList->list.array[recordIdx] == NULLP) { - DU_LOG("\nERROR --> DU APP: buildAndSendPagingToMac(); (Record) Memory Alloction failed!"); + DU_LOG("\nERROR --> DU APP: BuildAndSendDlPcchIndToMac(); (Record) Memory Alloction failed!"); break; } } @@ -644,7 +692,7 @@ uint8_t buildAndSendPagingReqToMac(uint16_t pf, uint8_t i_s, CmLListCp *pageUeLL pagingMsg->pagingRecordList->list.array[recordIdx]->ue_Identity.choice.ng_5G_S_TMSI.size); if(pagingMsg->pagingRecordList->list.array[recordIdx]->ue_Identity.choice.ng_5G_S_TMSI.buf == NULLP) { - DU_LOG("\nERROR --> DU APP: buildAndSendPagingToMac(); (5gsTmsi buffer) Memory Allocation failed!"); + DU_LOG("\nERROR --> DU APP: BuildAndSendDlPcchIndToMac(); (5gsTmsi buffer) Memory Allocation failed!"); break; } fillBitString(&pagingMsg->pagingRecordList->list.array[recordIdx]->ue_Identity.choice.ng_5G_S_TMSI,\ @@ -677,25 +725,33 @@ uint8_t buildAndSendPagingReqToMac(uint16_t pf, uint8_t i_s, CmLListCp *pageUeLL } else { - DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for RRCPDU for PagingMsg \n"); + DU_LOG("\nDEBUG --> F1AP : Created APER encoded buffer for RRC PDU for Pcch indication \n"); - DU_ALLOC_SHRABL_BUF(macPageReq, sizeof(MacPageReq)); - if(macPageReq == NULLP) + DU_ALLOC_SHRABL_BUF(macPcchInd, sizeof(MacPcchInd)); + if(macPcchInd == NULLP) { - DU_LOG("\nERROR --> DU APP: buildAndSendPagingToMac(); (macPageReq) Memory Alloction failed!"); + DU_LOG("\nERROR --> DU APP: BuildAndSendDlPcchIndToMac(); (macPcchInd) Memory Alloction failed!"); break; } - macPageReq->pf = pf; - macPageReq->i_s = i_s; - macPageReq->pduLen = encBufSize; - DU_ALLOC_SHRABL_BUF(macPageReq->pagePdu, macPageReq->pduLen); - if(macPageReq->pagePdu == NULLP) + macPcchInd->cellId = cellId; + macPcchInd->pf = pf; + macPcchInd->i_s = i_s; + macPcchInd->pduLen = encBufSize; + DU_ALLOC_SHRABL_BUF(macPcchInd->pcchPdu, macPcchInd->pduLen); + if(macPcchInd->pcchPdu == NULLP) + { + DU_LOG("\nERROR --> DU APP: BuildAndSendDlPcchIndToMac(); (PcchPDU) Memory Alloction failed!"); + break; + } + memcpy(macPcchInd->pcchPdu, encBuf, macPcchInd->pduLen); + ret = sendDlPcchIndToMac(macPcchInd); + if(ret != ROK) { - DU_LOG("\nERROR --> DU APP: buildAndSendPagingToMac(); (PagePDU) Memory Alloction failed!"); + 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)); break; } - memcpy(macPageReq->pagePdu, encBuf, macPageReq->pduLen); } ret = ROK; break; diff --git a/src/du_app/du_cell_mgr.h b/src/du_app/du_cell_mgr.h index 6a0736ebd..b7d3d1487 100644 --- a/src/du_app/du_cell_mgr.h +++ b/src/du_app/du_cell_mgr.h @@ -27,7 +27,7 @@ uint8_t duGetCellCb(uint16_t cellId, DuCellCb **cellCb); uint8_t BuildAndSendSliceConfigReq(RrmPolicy *rrmPolicy[], uint8_t totalRrrmPolicy, uint8_t totalSliceCfgReq); uint8_t BuildAndSendSliceReCfgReq(RrmPolicy *rrmPolicy[], uint8_t totalRrmPolicy, uint8_t totalSliceReCfg); uint8_t processPagingMsg(uint16_t cellId, DuPagingMsg *rcvdF1apPagingParam); -uint8_t buildAndSendPagingReqToMac(uint16_t pf, uint8_t i_s, CmLListCp *pageUeLL); +uint8_t BuildAndSendDlPcchIndToMac(uint16_t cellId, uint16_t pf, uint8_t i_s, CmLListCp *pageUeLL); #endif /********************************************************************** End of file