X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fdu_app%2Fdu_utils.c;h=608efb79a048051db4a2b4b8b89bc2a3f16fdf00;hb=0f3443e19182284b96f302a545e578cd55225dae;hp=342f31c41129b77db93935bd8de1a920127ad2e9;hpb=0d85ce70f63a02a38930c728a58702f9c8505e04;p=o-du%2Fl2.git diff --git a/src/du_app/du_utils.c b/src/du_app/du_utils.c index 342f31c41..608efb79a 100644 --- a/src/du_app/du_utils.c +++ b/src/du_app/du_utils.c @@ -21,10 +21,10 @@ #include "lrg.x" #include "lkw.x" #include "du_app_mac_inf.h" -#include "du_utils.h" #include "du_app_rlc_inf.h" #include "du_cfg.h" #include "du_mgr.h" +#include "du_utils.h" /* Spec Ref-38.214-Table 5.1.2.1-1 */ uint8_t slivCfgIdxTable[MAX_SLIV_CONFIG_IDX][3] = { @@ -245,90 +245,273 @@ uint8_t duDelNodeFromLList(CmLListCp *llist, CmLList *node) return ROK; } -/*Below function for printing will be used in future so disabling it for now*/ -#if 0 -/**************************************************************************** - * - * @brief Print the LC in list for debugging purpose +/******************************************************************* + * @brief Handle the PageUe List * * @details * - * Function : printLcLL + * Function : handlePageUeLL + * + * Functionality: Handling the (SEARCH,CREATE,DELETE) PageUeList + * + * @params[in] DuPagingMsg *pagingParam, CmLListCp *pageUeLL, ActionTypeLL + * action * - * Functionality: - * For debugging purpose, for printing the LC in the order and - * parameters + * @return DuPagUeRecord * - * @params[in] LcList pointer - * - * @return void - * - *************************************************************************/ -void printPageInfoLL(CmLListCp *pageInfoLL) + * ****************************************************************/ +DuPagUeRecord* handlePageUeLL(uint16_t pagUeId, uint64_t sTmsi, CmLListCp *pageUeLL, ActionTypeLL action) { - CmLList *node = NULLP; - DuPagUeList *pageInfoNode = NULLP; + CmLList *node = NULLP; + DuPagUeRecord *ueRecord = NULLP; + bool found = FALSE; - if(pageInfoLL == NULLP) + if((pageUeLL == NULLP) || + ((pageUeLL->first == NULLP) && (action != CREATE))) { - DU_LOG("\nINFO --> DU APP: PageInfo List doesnt exist"); - return; + DU_LOG("\nERROR --> DU APP: UE Page Record LL is empty"); + return NULLP; } - node = pageInfoLL->first; + node = pageUeLL->first; + while(node) { - pageInfoNode = (DuPagUeList *)node->node; - if(pageInfoNode) + ueRecord = (DuPagUeRecord *)node->node; + if(action == PRINT) { - DU_LOG("\nINFO --> DU APP i_s:%d",pageInfoNode->i_s); - printPageUeRecordLL(&(pageInfoNode->pagUeList)); + DU_LOG("\n INFO --> DU APP ueId:%d, sTmsi:%lu",\ + ueRecord->pagUeId, ueRecord->sTmsi); + } + else if(ueRecord && (ueRecord->pagUeId == pagUeId && + ueRecord->sTmsi == sTmsi)) + { + found = TRUE; + break; } - node = node->next; } + + switch(action) + { + case SEARCH: + { + if(!found) + { + ueRecord = NULLP; + } + return ueRecord; + } + + case CREATE: + { + if(node != NULLP) + return ueRecord; + + /*Need to add a new node for this LC*/ + + /*List is empty; Initialize the LL ControlPointer*/ + if(pageUeLL->count == 0) + { + cmLListInit(pageUeLL); + } + + ueRecord = NULLP; + /*Allocate the List*/ + DU_ALLOC(ueRecord, sizeof(DuPagUeRecord)); + if(ueRecord) + { + ueRecord->pagUeId = pagUeId; + ueRecord->sTmsi = sTmsi; + } + else + { + DU_LOG("\nERROR --> DU APP : Allocation of UE Record failed,ueId:%d",pagUeId); + return NULLP; + } + + if(duAddNodeToLList(pageUeLL, ueRecord, NULLP) == RFAILED) + { + DU_LOG("\nERROR --> DU APP : failed to Add Ue Record Node,ueId:%d",pagUeId); + DU_FREE(ueRecord, sizeof(DuPagUeRecord)); + return NULLP; + } + return ueRecord; + } + case DELETE: + { + if(!found || ueRecord == NULLP) + { + DU_LOG("\nERROR --> DU APP: UeId:%d not found; thus Deletion unsuccessful",pagUeId); + } + else + { + if(duDelNodeFromLList(pageUeLL, node) == ROK) + DU_FREE(ueRecord, sizeof(DuPagUeRecord)); + + DU_LOG("\nDEBUG --> DU APP: UeId:%d Deleted successfully",pagUeId); + } + return NULLP; + } + case PRINT: + case TRAVERSE_ALL: + { + break; + } + default: + { + DU_LOG("\nERROR --> DU APP: Incorrect ActionType:%d on UeRecord",action); + } + } + return NULLP; } -/**************************************************************************** - * - * @brief Print the Ue Record against Paging Frame for debugging purpose +/******************************************************************* + * @brief Handle the PageInfo List * * @details * - * Function : printLcLL + * Function : handlePageInfoLL * - * Functionality: - * For debugging purpose, for printing the UE Record in the order and - * parameters + * Functionality: Handling the (SEARCH,CREATE,DELETE) PageInfoList * - * @params[in] ueList pointer - * - * @return void - * - *************************************************************************/ -void printPageUeRecordLL(CmLListCp *ueList) + * @params[in] uint8_t i_s, CmLListCp *pagInfoLL, ActionTypeLL action + * + * @return DuPagUeList + * + * ****************************************************************/ +DuPagUeList* handlePageInfoLL(uint16_t pf, uint8_t i_s, CmLListCp *pagInfoLL, ActionTypeLL action) { - CmLList *node = NULLP; - DuPagUeRecord *ueRecord = NULLP; - - if(ueList == NULLP) + CmLList *node = NULLP, *next = NULLP; + DuPagUeList *pagInfo = NULLP; + bool found = FALSE; + + if((pagInfoLL == NULLP) || + ((pagInfoLL->first == NULLP) && (action != CREATE))) { - DU_LOG("\nINFO --> DU APP: PageUe List doesnt exist"); - return; + DU_LOG("\nERROR --> DU APP: PagInfo LL is empty"); + return NULLP; } - node = ueList->first; + node = pagInfoLL->first; + while(node) { - ueRecord = (DuPagUeRecord *)node->node; - if(ueRecord) + next = node->next; + pagInfo = (DuPagUeList *)node->node; + if(action == PRINT) + { + DU_LOG("\n INFO --> DU APP: Paging Index (i_s):%d",pagInfo->i_s); + handlePageUeLL(NULLD, NULLD, &(pagInfo->pagUeList), PRINT); + } + else if(action == TRAVERSE_ALL) { - DU_LOG("\nINFO --> DU APP ueId:%d, sTmsi:%lu, prio:%d",ueRecord->pagUeId, ueRecord->sTmsi, ueRecord->pagPriority); + return pagInfo; } + else if(pagInfo->i_s == i_s) + { + found = TRUE; + break; + } + node = next; + } - node = node->next; + switch(action) + { + case SEARCH: + { + if(!found) + { + pagInfo = NULLP; + } + return pagInfo; + } + + case CREATE: + { + if(node != NULLP) + return pagInfo; + + /*Need to add a new node for this LC*/ + + /*List is empty; Initialize the LL ControlPointer*/ + if(pagInfoLL->count == 0) + { + cmLListInit(pagInfoLL); + } + + pagInfo = NULLP; + /*Allocate the List*/ + DU_ALLOC(pagInfo, sizeof(DuPagUeList)); + if(pagInfo) + { + pagInfo->i_s = i_s; + } + else + { + DU_LOG("\nERROR --> DU APP : Allocation of List failed,i_s:%d",i_s); + return NULLP; + } + + if(duAddNodeToLList(pagInfoLL, pagInfo, NULLP) == RFAILED) + { + DU_LOG("\nERROR --> DU APP : failed to Add Node,i_s:%d",i_s); + DU_FREE(pagInfo, sizeof(DuPagUeList)); + return NULLP; + } + return pagInfo; + } + case DELETE: + { + if(!found || pagInfo == NULLP) + { + DU_LOG("\nERROR --> DU APP: i_s:%d not found; thus Deletion unsuccessful",i_s); + } + else + { + if(duDelNodeFromLList(pagInfoLL, node) == ROK) + DU_FREE(pagInfo, sizeof(DuPagUeList)); + + DU_LOG("\nDEBUG --> DU APP: i_s:%d Deleted successfully",i_s); + } + return NULLP; + } + case PRINT: + case TRAVERSE_ALL: + { + break; + } + default: + { + DU_LOG("\nERROR --> DU APP: Incorrect ActionType:%d on PageInfo List",action); + } } + return NULLP; +} + +/******************************************************************* + * @brief Find the PageInfo List from HashMap + * + * @details + * + * Function : findPagingInfoFromMap + * + * Functionality: Search for the PageInfoList for a PF from HashMap + * + * @params[in] uint16_t pf, CmHashListCp *pagingInfoMap + * + * @return DuPagInfoList + * + * ****************************************************************/ +DuPagInfoList* findPagingInfoFromMap(uint16_t pf, CmHashListCp *pagingInfoMap) +{ + DuPagInfoList *pagInfoLL = NULLP; + cmHashListFind(pagingInfoMap, (uint8_t *)&(pf), sizeof(uint16_t), 0, (PTR *)&pagInfoLL); + + return pagInfoLL; } +/*Below function for printing will be used in future so disabling it for now*/ +#if 0 /******************************************************************* * @brief Print the Page Info List and UE Records * @@ -353,14 +536,15 @@ void printPageList(CmHashListCp *pagingInfoMap) ret = cmHashListGetNext(pagingInfoMap, (PTR)prevPageInfoLL, (PTR *)&pagInfoLLFromPF); if(ret == ROK) { - DU_LOG("\nDEBUG --> DUAPP Page List for PF:%d",pagInfoLLFromPF->pf); - printPageInfoLL(&(pagInfoLLFromPF->pagInfoList)); + DU_LOG("\nDEBUG --> DUAPP: Page List for PF:%d",pagInfoLLFromPF->pf); + handlePageInfoLL(NULLD, NULLD, &(pagInfoLLFromPF->pagInfoList), PRINT); prevPageInfoLL = pagInfoLLFromPF; } }while(ret == ROK); } #endif + /********************************************************************** End of file **********************************************************************/