X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrrlc%2Frlc_msg_hdl.c;h=0495a44c1ae21acc8e368167725f0b826cb2e657;hb=af8f9c8f6f7cd5e0a89e5dfa7a566fa5811e110c;hp=4e2973471dcd5400c0c02af259765e4ede607b50;hpb=f33e70cfac9c2fa3ffbbbdf2183b4c8876974b96;p=o-du%2Fl2.git diff --git a/src/5gnrrlc/rlc_msg_hdl.c b/src/5gnrrlc/rlc_msg_hdl.c index 4e2973471..0495a44c1 100644 --- a/src/5gnrrlc/rlc_msg_hdl.c +++ b/src/5gnrrlc/rlc_msg_hdl.c @@ -22,28 +22,24 @@ #include "lkw.h" /* LKW defines */ #include "ckw.h" /* CKW defines */ #include "kwu.h" /* KWU defines */ -#include "kw_env.h" /* RLC environment options */ -#include "kw.h" /* RLC defines */ -#include "kw_udx.h" -#include "kw_ul.h" -#include "kw_dl.h" +#include "rlc_env.h" /* RLC environment options */ +#include "rlc_err.h" + /* header/extern include files (.x) */ #include "rgu.x" #include "lkw.x" /* LKW */ #include "ckw.x" /* CKW */ #include "kwu.x" /* KWU */ -#include "kw_err.h" -#include "kw.x" -#include "kw_udx.x" -#include "kw_dl.x" -#include "kw_ul.x" +#include "rlc_utils.h" /* RLC defines */ +#include "rlc_dl_ul_inf.h" +#include "rlc_dl.h" +#include "rlc_ul.h" #include "rlc_mac_inf.h" #include "du_app_rlc_inf.h" -#include "rlc_utils.h" #include "rlc_upr_inf_api.h" - +#include "rlc_mgr.h" /******************************************************************* * * @brief Fills RLC UL UE Cfg Rsp from RlcCRsp @@ -146,10 +142,11 @@ void fillEntModeAndDir(uint8_t *entMode, uint8_t *direction, RlcMode rlcMode) * RlcEntCfgInfo pointer * RlcBearerCfg pointer * Config Type - * @return void + * @return ROK - SUCCESS + * RFAILED - FAILURE * * ****************************************************************/ -void fillLcCfg(RlcEntCfgInfo *rlcUeCfg, RlcBearerCfg *duRlcUeCfg, uint8_t cfgType) +uint8_t fillLcCfg(RlcCb *gCb, RlcEntCfgInfo *rlcUeCfg, RlcBearerCfg *duRlcUeCfg) { uint8_t lChRbIdx = 0; @@ -157,8 +154,18 @@ void fillLcCfg(RlcEntCfgInfo *rlcUeCfg, RlcBearerCfg *duRlcUeCfg, uint8_t cfgTyp rlcUeCfg->rbType = duRlcUeCfg->rbType; // SRB or DRB rlcUeCfg->lCh[lChRbIdx].lChId = duRlcUeCfg->lcId; rlcUeCfg->lCh[lChRbIdx].type = duRlcUeCfg->lcType; + if(duRlcUeCfg->snssai) + { + RLC_ALLOC(gCb, rlcUeCfg->snssai, sizeof(Snssai)); + if(rlcUeCfg->snssai == NULLP) + { + DU_LOG("\nERROR --> RLC : fillLcCfg(): Failed to allocate memory for snssai"); + return RFAILED; + } + memcpy(rlcUeCfg->snssai, duRlcUeCfg->snssai, sizeof(Snssai)); + } fillEntModeAndDir(&rlcUeCfg->entMode, &rlcUeCfg->dir, duRlcUeCfg->rlcMode); - rlcUeCfg->cfgType = cfgType; + rlcUeCfg->cfgType = duRlcUeCfg->configType; switch(rlcUeCfg->entMode) { @@ -193,6 +200,7 @@ void fillLcCfg(RlcEntCfgInfo *rlcUeCfg, RlcBearerCfg *duRlcUeCfg, uint8_t cfgTyp default: break; }/* End of switch(entMode) */ + return ROK; } /******************************************************************* @@ -209,11 +217,12 @@ void fillLcCfg(RlcEntCfgInfo *rlcUeCfg, RlcBearerCfg *duRlcUeCfg, uint8_t cfgTyp * @params[in] * RlcEntCfgInfo pointer * RlcBearerCfg pointer - * @return void + * @return ROK - Success + * RFAILED - Failure * ******************************************************************/ -void fillRlcCfg(RlcCfgInfo *rlcUeCfg, RlcUeCfg *ueCfg) +uint8_t fillRlcCfg(RlcCb *gCb, RlcCfgInfo *rlcUeCfg, RlcUeCfg *ueCfg) { uint8_t lcIdx; @@ -224,10 +233,46 @@ void fillRlcCfg(RlcCfgInfo *rlcUeCfg, RlcUeCfg *ueCfg) for(lcIdx = 0; lcIdx < rlcUeCfg->numEnt; lcIdx++) { - fillLcCfg(&rlcUeCfg->entCfg[lcIdx], &ueCfg->rlcLcCfg[lcIdx], ueCfg->rlcLcCfg[lcIdx].configType); + if(fillLcCfg(gCb, &rlcUeCfg->entCfg[lcIdx], &ueCfg->rlcLcCfg[lcIdx]) != ROK) + { + DU_LOG("\nERROR --> RLC : fillRlcCfg(): Failed to fill LC configuration"); + return RFAILED; + } } + return ROK; } +/******************************************************************* + * + * @brief Fill RlcCfgCfmInfo structure for sending failure response to DU + * + * @details + * + * Function : fillRlcCfgFailureRsp + * + * Functionality: + * Fill RlcCfgCfmInfo structure for sending failure response to DU + * + * @params[in] RlcCfgCfmInfo *cfgRsp, RlcUeCfg *ueCfg + * + * @return void + * + * ****************************************************************/ +void fillRlcCfgFailureRsp(RlcCfgCfmInfo *cfgRsp, RlcUeCfg *ueCfg) +{ + uint8_t cfgIdx =0; + + cfgRsp->ueId = ueCfg->ueIdx; + cfgRsp->cellId = ueCfg->cellId; + cfgRsp->numEnt = ueCfg->numLcs; + for(cfgIdx =0; cfgIdxnumLcs; cfgIdx++) + { + cfgRsp->entCfgCfm[cfgIdx].rbId = ueCfg->rlcLcCfg[cfgIdx].rbId; + cfgRsp->entCfgCfm[cfgIdx].rbType = ueCfg->rlcLcCfg[cfgIdx].rbType; + cfgRsp->entCfgCfm[cfgIdx].status.status = RLC_DU_APP_RSP_NOK; + cfgRsp->entCfgCfm[cfgIdx].status.reason = CKW_CFG_REAS_NONE; + } +} /******************************************************************* * * @brief Handles Ue Create Request from DU APP @@ -248,11 +293,13 @@ void fillRlcCfg(RlcCfgInfo *rlcUeCfg, RlcUeCfg *ueCfg) uint8_t RlcProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg) { uint8_t ret = ROK; + RlcCb *gCb; RlcCfgInfo *rlcUeCfg = NULLP; + RlcCfgCfmInfo cfgRsp; + Pst rspPst; - RlcCb *rlcUeCb = NULLP; - rlcUeCb = RLC_GET_RLCCB(pst->dstInst); - RLC_ALLOC(rlcUeCb, rlcUeCfg, sizeof(RlcCfgInfo)); + gCb = RLC_GET_RLCCB(pst->dstInst); + RLC_ALLOC(gCb, rlcUeCfg, sizeof(RlcCfgInfo)); if(rlcUeCfg == NULLP) { DU_LOG("\nERROR --> RLC: Failed to allocate memory at RlcProcUeCreateReq()"); @@ -261,11 +308,21 @@ uint8_t RlcProcUeCreateReq(Pst *pst, RlcUeCfg *ueCfg) else { memset(rlcUeCfg, 0, sizeof(RlcCfgInfo)); - fillRlcCfg(rlcUeCfg, ueCfg); - ret = RlcProcCfgReq(pst, rlcUeCfg); + ret = fillRlcCfg(gCb, rlcUeCfg, ueCfg); if(ret != ROK) - DU_LOG("\nERROR --> RLC: Failed to configure Add/Mod/Del entities at RlcProcUeCreateReq()"); + { + DU_LOG("\nERROR --> RLC: Failed to fill configuration at RlcProcUeCreateReq()"); + FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_CREATE_RSP); + fillRlcCfgFailureRsp(&cfgRsp, ueCfg); + SendRlcUeCfgRspToDu(&rspPst, &cfgRsp); + } + else + { + ret = RlcProcCfgReq(pst, rlcUeCfg); + if(ret != ROK) + DU_LOG("\nERROR --> RLC: Failed to configure Add/Mod/Del entities at RlcProcUeCreateReq()"); + } } RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(RlcUeCfg)); return ret; @@ -424,13 +481,13 @@ uint8_t RlcProcUlData(Pst *pst, RlcData *ulData) if(ulData->pduInfo[idx].commCh) { RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_UL, RLC_POOL, cLchUlDat, \ - sizeof(RguCDatIndInfo)); - if(!cLchUlDat) - { - DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcProcUlData"); - ret = RFAILED; - break; - } + sizeof(RguCDatIndInfo)); + if(!cLchUlDat) + { + DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcProcUlData"); + ret = RFAILED; + break; + } memset(cLchUlDat, 0, sizeof(RguCDatIndInfo)); cLchUlDat->cellId = ulData->cellId; @@ -441,13 +498,13 @@ uint8_t RlcProcUlData(Pst *pst, RlcData *ulData) if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, &cLchUlDat->pdu) != ROK) { DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcProcUlData"); - RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, cLchUlDat, \ - sizeof(RguCDatIndInfo)); + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, cLchUlDat, \ + sizeof(RguCDatIndInfo)); ret = RFAILED; - break; + break; } oduCpyFixBufToMsg(ulData->pduInfo[idx].pduBuf, cLchUlDat->pdu, \ - ulData->pduInfo[idx].pduLen); + ulData->pduInfo[idx].pduLen); rlcProcCommLcUlData(pst, 0, cLchUlDat); } @@ -456,34 +513,34 @@ uint8_t RlcProcUlData(Pst *pst, RlcData *ulData) if(!dLchPduPres) { RLC_SHRABL_STATIC_BUF_ALLOC(RLC_MEM_REGION_UL, RLC_POOL, dLchUlDat, \ - sizeof(RguDDatIndInfo)); - if(!dLchUlDat) - { - DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcMacProcUlData"); - ret = RFAILED; - break; - } + sizeof(RguDDatIndInfo)); + if(!dLchUlDat) + { + DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcMacProcUlData"); + ret = RFAILED; + break; + } dLchPduPres = TRUE; } - /* Copy fixed buffer to message */ - lcId = ulData->pduInfo[idx].lcId; - if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, \ - &dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu]) != ROK) - { - DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcMacProcUlData"); - for(pduIdx=0; pduIdx < dLchData[lcId].pdu.numPdu; pduIdx++) - { - ODU_PUT_MSG_BUF(dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu]); - } - RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, dLchUlDat, \ - sizeof(RguDDatIndInfo)); - ret = RFAILED; - break; - } - oduCpyFixBufToMsg(ulData->pduInfo[idx].pduBuf, \ - dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu],\ - ulData->pduInfo[idx].pduLen); + /* Copy fixed buffer to message */ + lcId = ulData->pduInfo[idx].lcId; + if(ODU_GET_MSG_BUF(RLC_MEM_REGION_UL, RLC_POOL, \ + &dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu]) != ROK) + { + DU_LOG("\nERROR --> RLC : Memory allocation failed at RlcMacProcUlData"); + for(pduIdx=0; pduIdx < dLchData[lcId].pdu.numPdu; pduIdx++) + { + ODU_PUT_MSG_BUF(dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu]); + } + RLC_SHRABL_STATIC_BUF_FREE(RLC_MEM_REGION_UL, RLC_POOL, dLchUlDat, \ + sizeof(RguDDatIndInfo)); + ret = RFAILED; + break; + } + oduCpyFixBufToMsg(ulData->pduInfo[idx].pduBuf, \ + dLchData[lcId].pdu.mBuf[dLchData[lcId].pdu.numPdu],\ + ulData->pduInfo[idx].pduLen); dLchData[lcId].pdu.numPdu++; } @@ -495,26 +552,26 @@ uint8_t RlcProcUlData(Pst *pst, RlcData *ulData) { if(dLchPduPres) { - dLchUlDat->cellId = ulData->cellId; - GET_UE_IDX(ulData->rnti, dLchUlDat->rnti); - - for(idx = 0; idx < MAX_NUM_LC; idx++) - { - if(dLchData[idx].pdu.numPdu) - { - memcpy(&dLchUlDat->lchData[numDLch], &dLchData[idx], sizeof(RguLchDatInd)); - numDLch++; - } - } - dLchUlDat->numLch = numDLch; - rlcProcDedLcUlData(pst, 0, dLchUlDat); + dLchUlDat->cellId = ulData->cellId; + GET_UE_IDX(ulData->rnti, dLchUlDat->rnti); + + for(idx = 0; idx < MAX_NUM_LC; idx++) + { + if(dLchData[idx].pdu.numPdu) + { + memcpy(&dLchUlDat->lchData[numDLch], &dLchData[idx], sizeof(RguLchDatInd)); + numDLch++; + } + } + dLchUlDat->numLch = numDLch; + rlcProcDedLcUlData(pst, 0, dLchUlDat); } } for(pduIdx = 0; pduIdx < ulData->numPdu; pduIdx++) { RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ulData->pduInfo[pduIdx].pduBuf, \ - ulData->pduInfo[pduIdx].pduLen); + ulData->pduInfo[pduIdx].pduLen); } RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ulData, sizeof(RlcData)); return ROK; @@ -647,7 +704,9 @@ uint8_t RlcProcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg) uint8_t ret = ROK; RlcCfgInfo *rlcUeCfg = NULLP; //Seed code Rlc cfg struct RlcCb *rlcUeCb = NULLP; - + RlcCfgCfmInfo *cfgRsp; + Pst rspPst; + DU_LOG("\nDEBUG --> RLC: UE reconfig request received. CellID[%d] UEIDX[%d]",ueCfg->cellId, ueCfg->ueIdx); rlcUeCb = RLC_GET_RLCCB(pst->dstInst); @@ -660,10 +719,21 @@ uint8_t RlcProcUeReconfigReq(Pst *pst, RlcUeCfg *ueCfg) else { memset(rlcUeCfg, 0, sizeof(RlcCfgInfo)); - fillRlcCfg(rlcUeCfg, ueCfg); - ret = RlcProcCfgReq(pst, rlcUeCfg); + ret = fillRlcCfg(rlcUeCb, rlcUeCfg, ueCfg); if(ret != ROK) - DU_LOG("\nERROR --> RLC: Failed to configure Add/Mod/Del entities at RlcProcUeReconfigReq()"); + { + DU_LOG("\nERROR --> RLC: Failed to fill configuration at RlcProcUeReconfigReq()"); + FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_RECONFIG_RSP); + memset(cfgRsp, 0, sizeof(RlcCfgCfmInfo)); + fillRlcCfgFailureRsp(cfgRsp, ueCfg); + SendRlcUeCfgRspToDu(&rspPst, cfgRsp); + } + else + { + ret = RlcProcCfgReq(pst, rlcUeCfg); + if(ret != ROK) + DU_LOG("\nERROR --> RLC: Failed to configure Add/Mod/Del entities at RlcProcUeReconfigReq()"); + } } RLC_FREE_SHRABL_BUF(pst->region, pst->pool, ueCfg, sizeof(RlcUeCfg)); @@ -700,7 +770,7 @@ uint8_t RlcProcDlUserDataTransfer(Pst *pst, RlcDlUserDataInfo *dlDataMsgInfo) if(!datReqInfo) { DU_LOG("\nERROR --> RLC_DL : Memory allocation failed for DatReq in RlcProcDlUserDataTransfer()"); - RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlDataMsgInfo->dlMsg, dlDataMsgInfo->msgLen); + ODU_PUT_MSG_BUF(dlDataMsgInfo->dlMsg); RLC_SHRABL_STATIC_BUF_FREE(pst->region, pst->pool, dlDataMsgInfo, sizeof(RlcDlUserDataInfo)); return RFAILED; } @@ -734,13 +804,13 @@ uint8_t RlcProcDlUserDataTransfer(Pst *pst, RlcDlUserDataInfo *dlDataMsgInfo) * Functionality: * sending UE delete response to DU * - * @params[in] uint8_t ueIdx, uint8_t cellId, UeDeleteResult result + * @params[in] uint8_t cellId, uint8_t ueIdx, UeDeleteResult result * * @return ROK - success * RFAILED - failure * * ****************************************************************/ -uint8_t sendRlcUeDeleteRspToDu(uint8_t ueIdx, uint16_t cellId, UeDeleteResult result) +uint8_t sendRlcUeDeleteRspToDu(uint16_t cellId,uint8_t ueId, UeDeleteResult result) { Pst pst; RlcUeDeleteRsp *ueDeleteRsp = NULLP; @@ -756,7 +826,7 @@ uint8_t sendRlcUeDeleteRspToDu(uint8_t ueIdx, uint16_t cellId, UeDeleteResult re else { ueDeleteRsp->cellId = cellId; - ueDeleteRsp->ueIdx = ueIdx; + ueDeleteRsp->ueId = ueId; ueDeleteRsp->result = result; if(rlcSendUeDeleteRspToDu(&pst, ueDeleteRsp) == ROK) @@ -773,41 +843,6 @@ uint8_t sendRlcUeDeleteRspToDu(uint8_t ueIdx, uint16_t cellId, UeDeleteResult re return ROK; } -/* **************************************************************** -* -* @brief filling RLC UE delete configuration -* -* @details -* -* Function : fillRlcCfgInfo -* -* Functionality: filling RLC UE delete configuration -* -* @params[in] RlcUlUeCb *ueCb, RlcCfgInfo *rlcUeCfg -* -* @return void -* -* ****************************************************************/ - -void fillRlcUeDelInfo(RlcUlUeCb *ueCb, RlcCfgInfo *rlcUeCfg) -{ - uint8_t lcIdx; - - rlcUeCfg->ueId = ueCb->ueId; - rlcUeCfg->cellId = ueCb->cellId; - rlcUeCfg->numEnt = 0; - for(lcIdx=0; lcIdxnumEnt < 1; lcIdx++) - { - if(ueCb->lCh[lcIdx].ulRbCb != NULLP) - { - rlcUeCfg->entCfg[rlcUeCfg->numEnt].rbId = 0; - rlcUeCfg->entCfg[rlcUeCfg->numEnt].rbType = 0; - rlcUeCfg->entCfg[rlcUeCfg->numEnt].cfgType = CKW_CFG_DELETE_UE; - rlcUeCfg->numEnt++; - } - } -} - /******************************************************************* * * @brief Handles Ue delete Request from DU APP @@ -830,35 +865,23 @@ uint8_t RlcProcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete) { uint8_t ret = ROK; RlcCb *gRlcCb = NULLP; - RlcCfgInfo *rlcUeCfg = NULLP; RlcUlUeCb *ueCb = NULLP; UeDeleteResult result=SUCCESSFUL; - DU_LOG("\nDEBUG --> RLC: UE Delete request received. CellID[%d] UEIDX[%d]",ueDelete->cellId, ueDelete->ueIdx); + DU_LOG("\nDEBUG --> RLC: UE Delete request received. CellID[%d] UEID[%d]",ueDelete->cellId, ueDelete->ueId); if(ueDelete != NULLP) { gRlcCb = RLC_GET_RLCCB(pst->dstInst); - rlcDbmFetchUlUeCb(gRlcCb,ueDelete->ueIdx, ueDelete->cellId, &ueCb); + rlcDbmFetchUlUeCb(gRlcCb,ueDelete->ueId, ueDelete->cellId, &ueCb); if(ueCb != NULLP) { if(ueDelete->cellId == ueCb->cellId) { - RLC_ALLOC(gRlcCb, rlcUeCfg, sizeof(RlcCfgInfo)); - if(rlcUeCfg == NULLP) - { - DU_LOG("\nERROR --> RLC: deleteRlcUeCb(): Failed to allocate memory"); - ret = RFAILED; - } - else + memcpy(&ueCb->ueDeleteInfo.pst, pst, sizeof(Pst)); + if((rlcChkTmr(gRlcCb, (PTR)ueCb, EVENT_RLC_UE_DELETE_TMR)) == FALSE) { - memset(rlcUeCfg, 0, sizeof(RlcCfgInfo)); - fillRlcUeDelInfo(ueCb, rlcUeCfg); - if(RlcProcCfgReq(pst, rlcUeCfg) != ROK) - { - DU_LOG("\nERROR --> RLC: deleteRlcUeCb(): Failed to delete UE information"); - result = INVALID_UEID; - } + rlcStartTmr(gRlcCb,(PTR)ueCb, EVENT_RLC_UE_DELETE_TMR); } } else @@ -873,7 +896,7 @@ uint8_t RlcProcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete) if(result != SUCCESSFUL) { - ret = sendRlcUeDeleteRspToDu(ueDelete->ueIdx, ueDelete->cellId, result); + ret = sendRlcUeDeleteRspToDu(ueDelete->cellId, ueDelete->ueId, result); if(ret != ROK) { DU_LOG("\nERROR --> RLC: RlcProcUeDeleteReq():Failed to send UE Delete response to DU"); @@ -889,6 +912,170 @@ uint8_t RlcProcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete) return ret; } +/******************************************************************* +* +* @brief Send the Slice Metrics to DU APP +* +* @details +* +* Function : sendSlicePmToDu +* +* Functionality: +* Handles the sending of Slice Metrics to DU APP +* +* @params[in] Post structure pointer +* SlicePmList *sliceStats pointer +* +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t sendSlicePmToDu(SlicePmList *sliceStats) +{ + Pst pst; + + FILL_PST_RLC_TO_DUAPP(pst, RLC_UL_INST, EVENT_RLC_SLICE_PM_TO_DU); + + if(!sliceStats) + { + DU_LOG("\nERROR --> RLC: sendSlicePmToDu(): Memory allocation failed "); + return RFAILED; + } + else + { + if(rlcSendSlicePmToDu(&pst, sliceStats) == ROK) + { + DU_LOG("\nDEBUG --> RLC: Slice PM send successfully"); + } + else + { + DU_LOG("\nERROR --> RLC: sendSlicePmToDu():Failed to send Slice PM to DU"); + RLC_FREE_SHRABL_BUF(pst.region, pst.pool, sliceStats, sizeof(SlicePmList)); + return RFAILED; + } + } + return ROK; +} + +/** + * @brief + * Handler for searching the Slice Entry in Slice Metrics structure + * + * @details + * This func finds the slice entry in the SliceMetric record structure and + * return the index of the slice sot hat Tput entries can be done + * + * @param[in] snssaiVal : Snssai Val to be searched + * *snssaiIdx : O/P : Index of the Slice in Slice Metrics record + * sliceStats : Pointer of Slice metrics record list + * + * @return bool: True: If slice found in the record + * False: If Slice not found; thus parent function will create the + * recpord of this snssai + * + */ +bool rlcFindSliceEntry(uint32_t snssaiVal, uint8_t *snssaiIdx, SlicePmList *sliceStats) +{ + uint8_t cntSlices = sliceStats->numSlice; + + for(*snssaiIdx = 0;(*snssaiIdx) < cntSlices; (*snssaiIdx)++) + { + if(snssaiVal == sliceStats->sliceRecord[*snssaiIdx].networkSliceIdentifier) + { + return TRUE; + } + } + DU_LOG("\nERROR --> RLC: Total no of Slice exhausted!"); + return FALSE; +} + + +/******************************************************************* +* +* @brief Builds the Slice Performance Metrics structure to be sent to DU +* +* @details +* +* Function : BuildSliceReportToDu +* +* Functionality: +* Builds the Slice Performance Metrics structure to be sent to DU +* +* @params[in] uint8_t snssaiCnt +* +* @return ROK - success +* RFAILED - failure +* +* ****************************************************************/ +uint8_t BuildSliceReportToDu(uint8_t snssaiCnt) +{ + CmLList *node = NULLP; + RlcTptPerSnssai *snssaiNode = NULLP; + Direction dir = DIR_UL; + SlicePmList *sliceStats = NULLP; /*Slice metric */ + uint32_t snssaiVal = 0; + uint8_t snssaiIdx = 0; + + if(snssaiCnt == 0) + { + DU_LOG("\nERROR --> RLC: No SNSSAI to send the SLice PM"); + return RFAILED; + } + + RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, sliceStats, sizeof(SlicePmList)); + if(sliceStats == NULLP) + { + DU_LOG("\nERROR --> RLC: Memory Allocation Failed"); + return RFAILED; + } + RLC_ALLOC_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, sliceStats->sliceRecord, snssaiCnt * (sizeof(SlicePm))); + + if(sliceStats->sliceRecord == NULLP) + { + DU_LOG("\nERROR --> RLC: Memory Allocation Failed"); + RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, sliceStats, sizeof(SlicePmList)); + return RFAILED; + } + while(dir < DIR_BOTH) + { + node = arrTputPerSnssai[dir]->first; + if(node == NULLP) + { + DU_LOG("\nERROR --> RLC: No SNSSAI in list"); + RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, sliceStats, sizeof(SlicePmList)); + RLC_FREE_SHRABL_BUF(RLC_MEM_REGION_UL, RLC_POOL, sliceStats->sliceRecord, (snssaiCnt * (sizeof(SlicePm)))); + return RFAILED; + } + + while(node) + { + snssaiVal = 0; + snssaiIdx = 0; + snssaiNode = (RlcTptPerSnssai *)node->node; + + memcpy(&snssaiVal, snssaiNode->snssai, sizeof(Snssai)); + + if(rlcFindSliceEntry(snssaiVal, &snssaiIdx, sliceStats) == FALSE) + { + sliceStats->sliceRecord[snssaiIdx].networkSliceIdentifier = snssaiVal; + sliceStats->numSlice++; + } + if(dir == DIR_UL) + { + sliceStats->sliceRecord[snssaiIdx].ThpUl = snssaiNode->tpt; + } + else + { + sliceStats->sliceRecord[snssaiIdx].ThpDl = snssaiNode->tpt; + } + node = node->next; + } + dir++; + } + + sendSlicePmToDu(sliceStats); + return ROK; +} /********************************************************************** End of file **********************************************************************/