X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrrlc%2Frlc_upr_inf_mgr.c;h=9c99b63a350048822cbf653a79236493edf1bdda;hb=bd2905b5f651349abafb7934a952414d7c24e291;hp=4cbc070cf12011e25bb18cca06673eb2e8df8b56;hpb=be872311899d115fdf4565e4811cc8b37226ac53;p=o-du%2Fl2.git diff --git a/src/5gnrrlc/rlc_upr_inf_mgr.c b/src/5gnrrlc/rlc_upr_inf_mgr.c index 4cbc070cf..9c99b63a3 100755 --- a/src/5gnrrlc/rlc_upr_inf_mgr.c +++ b/src/5gnrrlc/rlc_upr_inf_mgr.c @@ -244,6 +244,7 @@ Pst *pst, RlcCfgInfo *cfg ) { + uint8_t cfgIdx = 0; RlcCb *tRlcCb; RlcUlCfgTmpData *cfgTmpData; @@ -252,6 +253,10 @@ RlcCfgInfo *cfg #if (ERRCLASS & ERRCLS_INT_PAR) if (pst->dstInst >= MAX_RLC_INSTANCES) { + for(cfgIdx=0; cfgIdxnumEnt; cfgIdx++) + { + RLC_PST_FREE(pst->region, pst->pool, cfg->entCfg[cfgIdx].snssai, sizeof(Snssai)); + } RLC_PST_FREE(pst->region, pst->pool, cfg, sizeof(RlcCfgInfo)); return RFAILED; } @@ -262,6 +267,10 @@ RlcCfgInfo *cfg if (cfgTmpData == NULLP) { + for(cfgIdx=0; cfgIdxnumEnt; cfgIdx++) + { + RLC_PST_FREE(pst->region, pst->pool, cfg->entCfg[cfgIdx].snssai, sizeof(Snssai)); + } RLC_PST_FREE(pst->region, pst->pool, cfg, sizeof(RlcCfgInfo)); return RFAILED; } @@ -276,6 +285,10 @@ RlcCfgInfo *cfg if (rlcDbmAddUlTransaction(tRlcCb, cfgTmpData) != ROK) { DU_LOG("\nERROR --> RLC_UL : Addition to UL transId Lst Failed"); + for(cfgIdx=0; cfgIdxnumEnt; cfgIdx++) + { + RLC_PST_FREE(pst->region, pst->pool, cfg->entCfg[cfgIdx].snssai, sizeof(Snssai)); + } RLC_PST_FREE(pst->region, pst->pool, cfg, sizeof(RlcCfgInfo)); return RFAILED; @@ -802,6 +815,275 @@ KwuDiscSduInfo *discSdu return ROK; } + +/** + * @brief + * Handler for Creating, Searching or Deleting SnssnaiTput List. + * + * @details + * This function is called whenever a new LC is configured with a snssai. + * This function is called to search for Snssai Node during RLC SDU formation + * + * @param[in] gCb RlcCb + * @param[in] snssai Snssai to be handled + * @param[in] Action Type of action to be handled(Create,Search,Delete) + * + * @return RlcTptPerSnssai + * -# Snssai Node + * + */ +RlcTptPerSnssai* rlcHandleSnssaiTputlist(RlcCb *gCb, Snssai *snssai, ActionTypeLL action, Direction dir) +{ + CmLListCp *snssaiList = NULLP; + CmLList *node = NULLP; + RlcTptPerSnssai *snssaiNode = NULLP; + bool found = FALSE; + + if(dir == DIR_DL) + { + snssaiList = gCb->rlcThpt.snssaiTputInfo.dlTputPerSnssaiList; + if(action == CREATE) + { + if(snssaiList == NULLP) + { + RLC_ALLOC(gCb, gCb->rlcThpt.snssaiTputInfo.dlTputPerSnssaiList, sizeof(CmLListCp)); + snssaiList = gCb->rlcThpt.snssaiTputInfo.dlTputPerSnssaiList; + cmLListInit(snssaiList); + } + } + else + { + if(snssaiList == NULLP) + { + DU_LOG("\nERROR --> RLC: SNSSAI DL list doesnt exist!"); + return NULLP; + } + } + } + else if(dir == DIR_UL) + { + snssaiList = gCb->rlcThpt.snssaiTputInfo.ulTputPerSnssaiList; + if(action == CREATE) + { + if(snssaiList == NULLP) + { + RLC_ALLOC(gCb, gCb->rlcThpt.snssaiTputInfo.ulTputPerSnssaiList, sizeof(CmLListCp)); + snssaiList = gCb->rlcThpt.snssaiTputInfo.ulTputPerSnssaiList; + cmLListInit(snssaiList); + } + } + else + { + if(snssaiList == NULLP) + { + DU_LOG("\nERROR --> RLC: SNSSAI UL list doesnt exist!"); + return NULLP; + } + } + } + else + { + DU_LOG("\nERROR --> RLC : Direction:%d is invalid", dir); + return NULLP; + } + + node = snssaiList->first; + + /*Traversing the LC LinkList*/ + while(node) + { + snssaiNode = (RlcTptPerSnssai *)node->node; + if(memcmp(snssaiNode->snssai, snssai, sizeof(Snssai)) == 0) + { + DU_LOG("\nDEBUG --> RLC : SNSSAI found in LL"); + found = TRUE; + break; + } + node = node->next; + }//end of while + + switch(action) + { + case SEARCH: + { + if(!found) + { + snssaiNode = NULLP; + } + return (snssaiNode); + } + + case CREATE: + { + if(found) + return (snssaiNode); + + snssaiNode = NULLP; + /*Allocate the List*/ + RLC_ALLOC(gCb, snssaiNode, sizeof(RlcTptPerSnssai)); + if(snssaiNode) + { + RLC_ALLOC(gCb, snssaiNode->snssai, sizeof(Snssai)); + if(snssaiNode->snssai == NULLP) + { + DU_LOG("\nERROR --> RLC : Allocation of SNSSAI node failed"); + return NULLP; + } + memcpy(snssaiNode->snssai,snssai,sizeof(Snssai)); + snssaiNode->dataVol = 0; + } + else + { + DU_LOG("\nERROR --> RLC : Allocation of SNSSAI node failed"); + return NULLP; + } + + node = NULLP; + RLC_ALLOC(gCb, node, sizeof(CmLList)); + if(node) + { + node->node = (PTR)snssaiNode; + cmLListAdd2Tail(snssaiList, node); + } + else + { + DU_LOG("\nERROR --> RLC : Allocation of SNSSAI node failed"); + return NULLP; + } + DU_LOG("\nDEBUG --> RLC : SNSSAI node added successfully"); + return (snssaiNode); + } + + case DELETE: + { + if(found && node) + { + node = cmLListDelFrm(snssaiList, node); + RLC_FREE(gCb, node, sizeof(CmLList)); + RLC_FREE(gCb, snssaiNode, sizeof(RlcTptPerSnssai)); + DU_LOG("\nDEBUG --> RLC : SNSSAI node found and deletion performed"); + + if(snssaiList->count == 0) + { + RLC_FREE(gCb, snssaiList, sizeof(CmLListCp)); + DU_LOG("\nINFO --> RLC : This SNSSAI was last in the list thus freeing the list also"); + } + } + else + { + DU_LOG("\nERROR --> RLC : SNSSAI node not found in List thus no deletion performed"); + } + return NULLP; + } + } + return (snssaiNode); +} + +/** + * @brief + * Handler for Deleting SnssnaiTput List. + * + * @details + * This function is called during Shutdown to remove all the snssai entries + * and deallocate the SNSSAI tput list as well + * + * @param[in] gCb RlcCb + * + * @return uint_8 (ROK/RFAILED) + * + */ +uint8_t rlcDelTputSnssaiList(RlcCb *gCb, Direction dir) +{ + CmLListCp *snssaiList = NULLP; + CmLList *node = NULLP, *next = NULLP; + RlcTptPerSnssai *snssaiNode = NULLP; + if(dir == DIR_DL) + { + snssaiList = gCb->rlcThpt.snssaiTputInfo.dlTputPerSnssaiList; + } + else if(dir == DIR_UL) + { + snssaiList = gCb->rlcThpt.snssaiTputInfo.ulTputPerSnssaiList; + } + else + { + DU_LOG("\nERROR --> RLC: Invalid direction:%d",dir); + return RFAILED; + } + if(snssaiList == NULLP) + { + DU_LOG("\nERROR --> RLC: SnssaiList not exist"); + return RFAILED; + } + node = snssaiList->first; + + /*Traversing the LC LinkList*/ + while(node) + { + snssaiNode = (RlcTptPerSnssai *)node->node; + next = node->next; + node = cmLListDelFrm(snssaiList, node); + RLC_FREE(gCb, node, sizeof(CmLList)); + RLC_FREE(gCb, snssaiNode, sizeof(RlcTptPerSnssai)); + node = next; + } + if(snssaiList->count == 0) + { + RLC_FREE(gCb, snssaiList, sizeof(CmLListCp)); + DU_LOG("\nDEBUG --> RLC : This SNSSAI was last in the list thus freeing the list also"); + } + return ROK; +} + +/** + * @brief + * Handler for calculating the Tput for each SNSSAI in Tput list after expiry. + * + * @details + * This function is called whenever SNSSAI Tput timer expires and calculate + * Tput for each Snssai in list + * + * @param[in] SnssaiList A list of Snssai + * + * @return void + * + */ +uint8_t rlcCalculateTputPerSnssai(CmLListCp *snssaiList, Direction dir) +{ + CmLList *node = NULLP; + RlcTptPerSnssai *snssaiNode = NULLP; + uint8_t snssaiCnt = 0; + + node = snssaiList->first; + if(node == NULLP) + { + DU_LOG("\n No SNSSAI in list"); + return(snssaiCnt); + } + /*Traversing the LC LinkList*/ + while(node) + { + snssaiNode = (RlcTptPerSnssai *)node->node; + snssaiNode->tpt = (double)(snssaiNode->dataVol * 8)/(double)(ODU_SNSSAI_THROUGHPUT_PRINT_TIME_INTERVAL * 0.001); + + if(dir == DIR_DL) + { + DU_LOG("\nDEBUG --> RLC_DL: SNSSAI(sst:%d,sd [%d,%d, %d]), DL Tpt : %.5lf", snssaiNode->snssai->sst,\ + snssaiNode->snssai->sd[0], snssaiNode->snssai->sd[1],snssaiNode->snssai->sd[2] , snssaiNode->tpt); + } + if(dir == DIR_UL) + { + DU_LOG("\nDEBUG --> RLC_UL: SNSSAI(sst:%d,sd [%d,%d, %d]), UL Tpt : %.5lf", snssaiNode->snssai->sst,\ + snssaiNode->snssai->sd[0], snssaiNode->snssai->sd[1],snssaiNode->snssai->sd[2] , snssaiNode->tpt); + } + + snssaiNode->dataVol = 0; + node = node->next; + snssaiCnt++; + } + return(snssaiCnt); +} + /********************************************************************30** End of file **********************************************************************/